I am currently trying to configure my player. This is the code that I have.
local platypus = require "platypus.platypus"
local config = {
collisions = {
separation = platypus.SEPARATION_RAYS,
groups = {
[hash("ground")] = platypus.DIR_ALL,
[hash("logs")] = platypus.DIR_ALL
},
left = 22, right = 22, top = 35, bottom = 43, offset = vmath.vector3(0, 0, 0)
},
gravity = -800,
max_velocity = 300,
allow_double_jump = false,
allow_wall_jump = false,
allow_wall_slide = false,
wall_slide_gravity = nil,
debug = true,
}
function init(self)
self.platypus = platypus.create(config)
end
function update(self, dt)
self.platypus.update(dt)
end
function on_message(self, message_id, message, sender)
self.platypus.on_message(message_id, message)
end
function on_input(self, action_id, action)
if action_id == hash("jump") then
if action.pressed then
self.platypus.jump(800)
elseif action.released then
self.platypus.abort_jump(0.5)
end
end
end
I’ve set the size of the hit box to fit the player. However, I don’t understand how to configure the collision groups. I’ve looked at the examples and the documentation and it just isn’t clear enough for me to understand. I assume that platypus.DIR_ALL has something to do with the directions in which the player can collide with said objects but I am unsure how I am supposed to link them to the actual game objects such as the ground. I assume it will involve me creating a platypus instance within my ground game object but I am still unsure how to go forward.
If you are able to help, I would appreciate it but if not, no worries.