Sambo wrote:I can't seem to figure out how to change the hitbox of a checkpoint. No matter what the size of the image is, it only triggers when I touch the top of it.
I also can't figure out how to get the checkpoint to save the values of my Data class. The instructions for multipoints:onCollected are horribly unclear. what is the function definition supposed to look like, exactly? I tried multipoints:onCollected(1) and multipoints:onCollected(self, 1). Both just threw an error. " <name> or "..." expected near '1'."
Currently the hitboxes are hard-coded as 32x32, for ease of placement. However, if you create a Lua checkpoint, you can set the
visible field to false, which will hide the checkpoint entirely. You can then create a custom hitbox that triggers the
collect function for that checkpoint.
As for
onCollected, that is an event, not a function. It's similar to
onLoop or
onEvent in that regard. It's called by the library whenever a checkpoint is collected, and you need to handle it as an event rather than trying to call it yourself. So you'd use it like this:
Code: Select all
function multipoints:onCollected(id)
if(id == 1) then
--do things
end
end