Multipoints

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 9 Sep 2015, 4:47

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'."
Image
Current Project:
Image

Hoeloe F
Nice citizen
Nice citizen
Hoeloe F
Nice citizen
Nice citizen
Reputation: 5
Posts: 16
Joined: 3 Nov 2014

Post #2by Hoeloe » 9 Sep 2015, 23:16

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

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 10 Sep 2015, 3:08

I don't get how classes work. It never made any sense to me. I just used and empty image for the checkpoint and made it trigger an event to show the activated checkpoint.
Image
Current Project:
Image


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest