zampa
Member
I wanted to add a laser as an obstacle, basically you would have the laser emitter and the laser it self that goes on until it hits a wall, and i was wondering how to implement that last thing.
My tiles are 32x32 so my idea was to run in a while statement a tilemap_get_at_pixel that checks that pixel if there is a wall, i would increment the position too check by 31-32 every time until it finds the wall, at that point i would check backwards to find the "first" pixel of the tile, at this point i would know the distance between the emitter and the wall, know it's only a matter to strech the laser sprite itself (the sprite is 19x1) until it touches the wall.
Is that a good way to do it?
How would you do it?
thanks
My tiles are 32x32 so my idea was to run in a while statement a tilemap_get_at_pixel that checks that pixel if there is a wall, i would increment the position too check by 31-32 every time until it finds the wall, at that point i would check backwards to find the "first" pixel of the tile, at this point i would know the distance between the emitter and the wall, know it's only a matter to strech the laser sprite itself (the sprite is 19x1) until it touches the wall.
Is that a good way to do it?
How would you do it?
thanks