diff options
author | Marcelo Costa <> | 2024-01-27 18:26:37 -0300 |
---|---|---|
committer | Marcelo Costa <> | 2024-01-27 18:26:37 -0300 |
commit | c63d013a3608ad473b1fcf14b83178bb2bfc20b7 (patch) | |
tree | b3ef3af284848f8b3d4bba655b88681c4c50a325 /game/microgames/baseball_kiss/pepe_character.gd | |
parent | 1aa604aca63ede5f97a68a1b20b51d157b3e614d (diff) | |
download | gamejam-ggj-2024-c63d013a3608ad473b1fcf14b83178bb2bfc20b7.tar.gz gamejam-ggj-2024-c63d013a3608ad473b1fcf14b83178bb2bfc20b7.tar.bz2 gamejam-ggj-2024-c63d013a3608ad473b1fcf14b83178bb2bfc20b7.zip |
Baseball Kiss Microgame MVP
Diffstat (limited to 'game/microgames/baseball_kiss/pepe_character.gd')
-rw-r--r-- | game/microgames/baseball_kiss/pepe_character.gd | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/game/microgames/baseball_kiss/pepe_character.gd b/game/microgames/baseball_kiss/pepe_character.gd new file mode 100644 index 0000000..35c5c06 --- /dev/null +++ b/game/microgames/baseball_kiss/pepe_character.gd @@ -0,0 +1,26 @@ +extends CharacterBody2D + + +const SPEED = 300.0 +const JUMP_VELOCITY = -400.0 +var player_control = true + +# Get the gravity from the project settings to be synced with RigidBody nodes. +var gravity = 0 + + +func _physics_process(delta): + # Add the gravity. + if not is_on_floor(): + velocity.y += gravity * delta + + if(player_control): + var direction = Input.get_axis("Left", "Right") + if direction: + velocity.x = direction * SPEED + %PepeSprite.animation = "walk" + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + %PepeSprite.animation = "default" + + move_and_slide() |