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.

Dark GDK / Clicking a sprtie.

Author
Message
winged Serpent
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 18th Aug 2008 05:00
What would be the easiest way to tell if you are clicking a sprite, or what sprite you are clicking. I really would prefer not to compare my mouse position to every sprite with a mouse related action.

Everyday the dreamers die to see whats on the other side.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 18th Aug 2008 07:25
Create a sprite with an invisible image the size of the hotspot you want for your mouse, position it at the mouse's location, and use sprite collision.


My site, for various stuff that I make.
winged Serpent
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 18th Aug 2008 07:34
Awesome idea, thanks a bunch.

Everyday the dreamers die to see whats on the other side.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 18th Aug 2008 08:31
if you have Sprite Priority set, only the lowest Sprite will be confirmed on collision. You have to compare every sprite one by one
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 18th Aug 2008 19:32
I suspect he's clicking buttons made of sprites, at which point comparing sprites one by one shouldn't be a problem.


My site, for various stuff that I make.
winged Serpent
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 19th Aug 2008 00:27
Well, im not clicking buttons I am mining rocks but I suppose I can compare each one. When you say lowest sprite do you mean the one drawn first, last, or something else?

http://wingedserpent776.deviantart.com/
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 21st Aug 2008 15:31 Edited at: 21st Aug 2008 15:32
you could always check if the mouse is over the sprite:
something like:



the code looks a bit ugly but it works great for buttons. so you can say: IsMouseOverSprite(rocksprite)

Login to post a reply

Server time is: 2024-09-30 05:41:34
Your offset time is: 2024-09-30 05:41:34