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 / Sprite Clicked On?

Author
Message
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 26th May 2009 04:39 Edited at: 26th May 2009 04:41
Is there any way to see if a specific sprite has been clicked on other than checking the mouse coords in a specific area once a button has been pressed?

Or would it be possible to create a function that once called would check the mouse coords then if it was over a sprite then return the sprites number?

=]

I <3 C++ & Dark GDK 4 2 maek mai gamezorz! =D
ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 26th May 2009 05:08
You could use a sprite cursor (in your loop you would update the position of your sprite cursor to that of your mouse position). You would than be able to use the commands for sprite collision to check if the sprite is being clicked on.

You could make a function that would return the sprite at the mouse position, but I don't know of any other way to do this other than to check every sprite you want to check one by one, and this would probably slow down your program if you have a large number of sprites.

------------------------------------
Currently 1500+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.
Flatbattery
15
Years of Service
User Offline
Joined: 2nd May 2009
Location: Brum, UK
Posted: 26th May 2009 21:49
This is a simple version of a function I use.
If you ID all your sprites you want to use in a sequence, say 20 to 30 for example, then simply call function

clickbutton(20,30);

It will then return the ID of the sprite clicked on.













Didn't have time to test this, but it was taken from a working function which also used the arrow keys and highlighted sprites when you are over them.

Login to post a reply

Server time is: 2024-11-05 18:54:00
Your offset time is: 2024-11-05 18:54:00