Log In  

Hey, I'm making a small game.

I need to get the flag value of a sprite I'm drawing and moving in the _draw function.
I need to know when the player hits the sprite. But I can't use mget() to get sprite number of it, because the sprite is not part of the map..

Any ideas how to go about it?
Right now I'm just using pget() to register it by color, but that solution is not super stable with so few colors ;)

Hope someone can help.

P#26604 2016-08-06 17:53 ( Edited 2016-08-11 19:48)

Jelpi has pretty clear collision code. Just ctrl-f "collide" and ctrl-g some to find all the relevant parts. It takes the difference in position, and compares that to the size of the two things colliding. (if they're closer together than they are tall/wide, then they have to be overlapping)

It actually runs through every active actor and checks if the player ran into it each frame. (works fine, since there's only a handful on screen at once) Inside collide_event() it uses the sprite number ("frame") to determine what to do in each case.

P#26774 2016-08-11 15:48 ( Edited 2016-08-11 19:48)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-12-05 20:57:23 | 0.006s | Q:8