diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-08-05 22:26:17 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-08-05 22:26:17 -0400 |
| commit | f38880a49047aeea9ff55a3f1fd13701688ca56f (patch) | |
| tree | f282ab1f7636ded4765a3e6f33e16e3824b6bb96 /game/characters | |
| parent | 0fdf6eebba1723f3d05e668d78bdc7669e679486 (diff) | |
| download | frivolous-run-f38880a49047aeea9ff55a3f1fd13701688ca56f.tar.gz frivolous-run-f38880a49047aeea9ff55a3f1fd13701688ca56f.tar.bz2 frivolous-run-f38880a49047aeea9ff55a3f1fd13701688ca56f.zip | |
New logo, pause, made more controls
Diffstat (limited to 'game/characters')
| -rw-r--r-- | game/characters/player/Player.gd | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/game/characters/player/Player.gd b/game/characters/player/Player.gd index f764015..ea87926 100644 --- a/game/characters/player/Player.gd +++ b/game/characters/player/Player.gd @@ -5,7 +5,7 @@ export var GRAVITY = 20 export var MAXFALLSPEED = 200 export var MAXSPEED = 80 export var JUMPFORCE = 300 -export var ACCEL = 10 +export var ACCEL = 20 var motion = Vector2() @@ -20,15 +20,23 @@ func _physics_process(_delta): if motion.y > MAXFALLSPEED: motion.y = MAXFALLSPEED + + motion.x = clamp(motion.x,-MAXSPEED,MAXSPEED) + + if Input.is_action_pressed("left"): + motion.x -= ACCEL + + elif Input.is_action_pressed("right"): + motion.x += ACCEL + else: + motion.x = lerp(motion.x,0,0.2) if is_on_floor(): - if Input.is_action_just_released("jump"): + if Input.is_action_just_pressed("jump"): motion.y = -JUMPFORCE pass - - motion.x = clamp(motion.x,-MAXSPEED,MAXSPEED) - motion.x += ACCEL + motion = move_and_slide(motion,UP) pass |
