diff options
Diffstat (limited to 'demos/2d/kinematic_col')
-rw-r--r-- | demos/2d/kinematic_col/colworld.scn | bin | 2941 -> 4073 bytes | |||
-rw-r--r-- | demos/2d/kinematic_col/player.gd | 23 | ||||
-rw-r--r-- | demos/2d/kinematic_col/player.scn | bin | 1495 -> 1625 bytes |
3 files changed, 9 insertions, 14 deletions
diff --git a/demos/2d/kinematic_col/colworld.scn b/demos/2d/kinematic_col/colworld.scn Binary files differindex 064ff12075..06607b7efd 100644 --- a/demos/2d/kinematic_col/colworld.scn +++ b/demos/2d/kinematic_col/colworld.scn diff --git a/demos/2d/kinematic_col/player.gd b/demos/2d/kinematic_col/player.gd index 36784a9d9f..ce09e1509e 100644 --- a/demos/2d/kinematic_col/player.gd +++ b/demos/2d/kinematic_col/player.gd @@ -2,35 +2,30 @@ extends KinematicBody2D # This is a simple collision demo showing how -# the kinematic cotroller works. +# the kinematic controller works. # move() will allow to move the node, and will # always move it to a non-colliding spot, # as long as it starts from a non-colliding spot too. +# Member variables +const MOTION_SPEED = 160 # Pixels/second -#pixels / second -const MOTION_SPEED=160 func _fixed_process(delta): - var motion = Vector2() if (Input.is_action_pressed("move_up")): - motion+=Vector2(0,-1) + motion += Vector2(0, -1) if (Input.is_action_pressed("move_bottom")): - motion+=Vector2(0,1) + motion += Vector2(0, 1) if (Input.is_action_pressed("move_left")): - motion+=Vector2(-1,0) + motion += Vector2(-1, 0) if (Input.is_action_pressed("move_right")): - motion+=Vector2(1,0) + motion += Vector2(1, 0) - motion = motion.normalized() * MOTION_SPEED * delta + motion = motion.normalized()*MOTION_SPEED*delta move(motion) - + func _ready(): - # Initalization here set_fixed_process(true) - pass - - diff --git a/demos/2d/kinematic_col/player.scn b/demos/2d/kinematic_col/player.scn Binary files differindex e558bffe8e..28ad204472 100644 --- a/demos/2d/kinematic_col/player.scn +++ b/demos/2d/kinematic_col/player.scn |