Hi !
I made a sprite which have the bound to layout behavior.
I would like to know when it touches the layout border.
Any idea how to do that ?
Develop games in your browser. Powerful, performant & highly capable.
one way is to put some invincible sprites to the layout corners and check for collisions
another way is to calculate the layoutwidth-layoutheight and the objects X so if the sprite for example comes near the last pixel of the layout you fire the event
The first one is more reliable if my sprite have a complex hitbox. Thank you !