Old-Sckool, on 11 March 2015 - 03:27 PM, said:
you don't have to disable the collision of a sprite to make it interactive in certain situations.
When you branch on a collision check, a list of all sprites that were collided into is generated with spr_collisions being the number of collisions, and spr_clist elements containing the sprite collided into. You can then loop over the list and pick and choose what sprites you want to interact with.
Your solution is nice though because it eliminates the need to track what sprite is what thing, and elements like coins can just collide into the player instead of the other way around.
Yeah true, and I covered that in part 3 on collision. With my example I gave, with the fire program, I only had to modify that program to change how it interacted with every other sprite on the board, versus modifying every other program to affect how they interact with fire. I guess both methods have their uses.
Another great use of this method would be enemies. They could be checking for collision when they have a defined collision box. They could then stop at custom blocks, hurt the player, and pass through any other sprites on board once collision is turned off, except doors.
This post has been edited by Graham: 12 March 2015 - 12:12 AM
Currently working on Servo for MegaZeux, I hope to complete it by the
middle of 2015? Who knows...
"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey