Skip to content

Commit 3a41106

Browse files
committed
Updating sample colision for use new RectMapCollider from from cocos.mapcolliders and implements the new method on_bump_handler
1 parent 5e0a4a3 commit 3a41106

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

intermediate/collision.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Import statements as usual
22
from cocos.sprite import Sprite
3-
from cocos.tiles import load, RectMapCollider
3+
from cocos.tiles import load
4+
from cocos.mapcolliders import RectMapCollider
45
from cocos.layer import ScrollingManager, ScrollableLayer, ColorLayer
56
from cocos.director import director
67
from cocos.scene import Scene
@@ -37,6 +38,8 @@ def start(self):
3738

3839
# We also tell the game that our sprite is starting on the ground
3940
self.on_ground = True
41+
def on_bump_handler(self, vx, vy):
42+
return (vx, vy)
4043

4144
# Now once again we update this "step" function
4245
def step(self, dt):

0 commit comments

Comments
 (0)