How to do a one-off collision?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to do a one-off collision?
I'm making a really small game where the player has to reach a door to get to the next level. The door has really simple collision detection where if the player is colliding with it then the collision function returns true. I just wanted to know if there's a way to make it return true just one time instead of every frame when something is colliding with it.
Re: How to do a one-off collision?
Have a variable 'door_collided' which is set to false at the beginning of the level. Check for collision only when it is false. Set it to true when the player collides with the door.
Re: How to do a one-off collision?
Or a table named Collided with all the objects that are currently in collision. like
Code: Select all
if collided["door"] then
next_level()
elseif collided["monster_guy001"] then
lives = lives -1
restart_from_checkpoint()
--ETCETERA
Hi! I wish you have an amazing day!
Re: How to do a one-off collision?
Thanks a bunch. I didn't realize it was so simple!
Who is online
Users browsing this forum: Bing [Bot] and 8 guests