Just a quick question


(Froom7) #1

Hey guys, I just have a quick question for a game I’m working on.
I assigned a hitbox to a graphic when it pops up (with setHitboxTo(graphic)).
Now my question is, how can I remove this hitbox when it goes down again?
Because when it goes down, it stil have it’s hitbox assigned and when you click on that spot while it’s down, it still performs an action while it shouldn’t.
Thanks in advance! :smiley:


(azrafe7) #2

Based on the info you gave us the only thing I could suggest is to set the collidable property to false. But don’t know exactly what you’re trying to do, the best solution depends on your needs and current setup.


(Kyuur) #3

As azrafe7 said, you can toggle collidable on and off. You could also use setHitbox() (no parameters needed, defaults to 0), and then reset the hitbox to your graphic object when needed. Or make your own bool variable to toggle and do something like this in the click function:

if (myBool) doStuff;

(Froom7) #4

Ah right, makes a bit more sense now. Thx for the help guys. Definitely helps a lot now :smiley: