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.

Code Snippets / Pick Sprite

Author
Message
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 9th Oct 2003 21:07
I love the Pick Object Command but I needed Pick Sprite so here it is



If you use a specific sprite number as Target it will return "1" if cursor is over Target sprite
Pick_Sprite(Target)

If you use Pick_Sprite(0) it will return the number of the lowest sprite only (if multiple sprites overlap)

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Oct 2003 01:34
You could achieve the same affect by checking if the mouse is in the borders of the sprite. To find the borders of the sprite it would just be like a collision box.

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - Johnrocs@aol.com
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 13th Oct 2003 06:58
RPGamer
If you had a program with 100 Sprites That would require you to loop through all sprites, check thier shape and test it against the cursor position. This function is far cleaner

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
genius
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: Utah, USA
Posted: 17th Oct 2003 09:57
so basicly, this will see if two objects are overlapping?
Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 18th Oct 2003 18:13
Not "Objects" "sprites"
The existing command PICK OBJECT is for that. Bascially the idea is to see if mouse is over a sprite by comparing a 1 pixel sprite positioned at MouseX(),MouseY(). I use it to good effect in the "Sunk / Raised Command Buttons" snippit in this forum

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX

Login to post a reply

Server time is: 2024-11-23 23:29:08
Your offset time is: 2024-11-23 23:29:08