Hi,
I’m trying to use platypus to work around the problem described in Directional platforms help.
I’m making an infinite runner type of game based on the “runner” example (https://defold.com/assets/endlessrunner/).
I drop my hero inside the level, so it starts “falling” and lands on the ground. But shortly after it lands, the hero sprite or spine (I tried both) disappears. With “debug = true”, the debug rays also disappear.
Here’s my hero.script:
local platypus = require "platypus.platypus"
function init(self)
msg.post(".", "acquire_input_focus")
self.platypus = platypus.create({
collisions = {
separation = platypus.SEPARATION_RAYS,
groups = {
[hash("geometry")] = platypus.DIR_ALL,
},
left = 40, right = 40, top = 40, bottom = 40,
},
gravity = -800,
max_velocity = 300,
allow_double_jump = false,
allow_wall_jump = false,
allow_wall_slide = true,
wall_slide_gravity = -3000,
debug = true,
})
end
function update(self, dt)
self.platypus.right(600)
self.platypus.update(dt)
end
function on_message(self, message_id, message, sender)
self.platypus.on_message(message_id, message, sender)
end
The hero is automatically moving to the right at 600 pixels/s.
The ground (collision group “geometry”) is moving at 600 pixels/s to the left. So the hero is “running” in place, which is what I want it to do.
Both hero and ground collision is set to “kinematic”.
When I turn on physics debug, i can still see the heros collision shapes and everything else works as expected.
The hero does not disappear if I change ground collisions to “static”. But setting it to that is not useful, as I want the ground to move.