Closed stefankendall closed 5 years ago
Thank you for reporting a problem. I took a look at your project and was able to reproduce the problem. This is what I did to debug:
this.platypus = platypus.create({
collisions = {
separation = platypus.SEPARATION_SHAPES,
groups = {
[hash("ground")] = platypus.DIR_ALL,
},
left = 7, right = 7, top = 10, bottom = 10,
},
max_velocity = 2000,
gravity = kGravity,
allow_double_jump = false,
allow_wall_jump = false,
debug = true,
})
Results in:
The size corresponds to left, right, top and bottom values passed into the config. The values should match the size of the collision shape. This is especially important since you have set collision resolution to happen using the collision shape (you could also resolve collisions based just on the result of the ray casts).
left = 54, right = 54, top = 75, bottom = 75,
This is better but obviously not right. It highlights the fact that I have assumed that the collision shape and sprites are centred around 0x0 while in your case the sprite is offset. If we change the left, right, top, bottom values to match we get this:
left = 54, right = 54, top = 108, bottom = 1,
But it doesn't work. The player falls through the ground. This is because the ray casts pointing down, down left and down right aren't angled properly and the one pointing straight down is almost 0 in length. Increasing bottom gives a better result:
left = 54, right = 54, top = 108, bottom = 10,
But the player is hovering above the ground. Not good. There are two alternatives now:
left = 54, right = 54, top = 75, bottom = 75,
Released 3.2.1 with this new config option.
https://github.com/britzl/platypus/releases/tag/3.2.1
See grottoescape game in project for example of use.
When setting a high launch speed or gravity, a game object is able to move through a platform going up (jumping), or through a platform going down (falling).
https://github.com/stefankendall/platform
https://github.com/stefankendall/platform/blob/master/high_gravity.mp4?raw=true