Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2 sprites at same cords, I want the one "on top"

Author
Message
starstrike
22
Years of Service
User Offline
Joined: 25th Nov 2003
Location:
Posted: 3rd Oct 2005 18:26
when 2 sprites occupy the same cords how do I detect the one in front ? currently Ive only been able to detect the one behind..
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 4th Oct 2005 00:42
I've been tackling the very same problem myself just today. At the moment, I'm using this function I've written:



which returns the sprite number of the top most sprite the mouse is over, between the lower and upper ranges declared. It returns 0 if the mouse isn't over a sprite within the range. It'll need adapting if you change the draw order of the sprites using sprite priority, though, because it assumes the topmost sprite has the highest sprite number. Also, I'm not exactly sure how the 'sprite height' command works, so it may screw up if the image size and sprite sizes are different.

X_MEN
22
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 9th Oct 2005 21:12
`use
SET SPRITE PRIORITY Sprite Number, Priority

You can do it if you try

Login to post a reply

Server time is: 2026-07-11 11:23:02
Your offset time is: 2026-07-11 11:23:02