summaryrefslogtreecommitdiff
path: root/demos/2d/kinematic_char
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-01-13 21:19:11 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-01-13 21:19:11 -0300
commit9012cd408e240d6039120e56fdd47a0983890993 (patch)
tree328f98f53fe1f56861dba304ec5e7456fb31c6ae /demos/2d/kinematic_char
parenta327eee762e7f67b924b481a05268cacfbbed4ec (diff)
-Add support for one-way collision in 2D (only works for kinematic body so far)
-Solve drawing order bug introduced in previous commit: solves #1214
Diffstat (limited to 'demos/2d/kinematic_char')
-rw-r--r--demos/2d/kinematic_char/colworld.scnbin5090 -> 6367 bytes
-rw-r--r--demos/2d/kinematic_char/player.gd5
-rw-r--r--demos/2d/kinematic_char/player.scnbin1511 -> 1728 bytes
3 files changed, 3 insertions, 2 deletions
diff --git a/demos/2d/kinematic_char/colworld.scn b/demos/2d/kinematic_char/colworld.scn
index b3a0a1f168..7b79a1d887 100644
--- a/demos/2d/kinematic_char/colworld.scn
+++ b/demos/2d/kinematic_char/colworld.scn
Binary files differ
diff --git a/demos/2d/kinematic_char/player.gd b/demos/2d/kinematic_char/player.gd
index 9cff0269e8..e8b3cc8d00 100644
--- a/demos/2d/kinematic_char/player.gd
+++ b/demos/2d/kinematic_char/player.gd
@@ -15,6 +15,7 @@ const GRAVITY = 500.0
#consider "floor".
const FLOOR_ANGLE_TOLERANCE = 40
const WALK_FORCE = 600
+const WALK_MIN_SPEED=10
const WALK_MAX_SPEED = 200
const STOP_FORCE = 1300
const JUMP_SPEED = 200
@@ -40,12 +41,12 @@ func _fixed_process(delta):
var stop=true
if (walk_left):
- if (velocity.x<=0 and velocity.x > -WALK_MAX_SPEED):
+ if (velocity.x<=WALK_MIN_SPEED and velocity.x > -WALK_MAX_SPEED):
force.x-=WALK_FORCE
stop=false
elif (walk_right):
- if (velocity.x>=0 and velocity.x < WALK_MAX_SPEED):
+ if (velocity.x>=-WALK_MIN_SPEED and velocity.x < WALK_MAX_SPEED):
force.x+=WALK_FORCE
stop=false
diff --git a/demos/2d/kinematic_char/player.scn b/demos/2d/kinematic_char/player.scn
index 126b332184..5809c0e98a 100644
--- a/demos/2d/kinematic_char/player.scn
+++ b/demos/2d/kinematic_char/player.scn
Binary files differ