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.

Newcomers DBPro Corner / how to click an object

Author
Message
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 11th Aug 2007 21:44
i am pretty decent at makign a game but i havent figured out some things yet, how do i make it where if a user clicks on an object it does something? (gosub)
thanks,
Wicked

Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 12th Aug 2007 02:49
you check if the mouse is at or near the objects screen position using the mousex,mousey,object screen x(),and object screen y() commands.
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 03:10
object screen? hmm im going to have to look into that
thanks

Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 12th Aug 2007 06:29
or just use the pick object command...


http://www.freewebs.com/zornoxstudios/
Learning C++ thanks DGDK
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 08:12
hm how would i do this with text?

Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 12th Aug 2007 08:21
Quote: "how do i make it where if a user clicks on an object it does something?"
hmmm, well you cant, why did you say object?

heres an example of what your trying todo.




http://www.freewebs.com/zornoxstudios/
Learning C++ thanks DGDK
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 12th Aug 2007 09:11
Quote: "hmmm, well you cant, why did you say object?"

You can't click an object? It's called pick object, look it up .


Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 12th Aug 2007 09:21 Edited at: 12th Aug 2007 09:22
Quote: "You can't click an object? It's called pick object, look it up"

I know...

...
Quote: "or just use the pick object command..."
I allready told him to use it

Quote: "hm how would i do this with text?"

he said...I answered his question thinking that he was thinking he could use the pick object command with text.


http://www.freewebs.com/zornoxstudios/
Learning C++ thanks DGDK
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 12th Aug 2007 09:25
well i want to know both THANKS a MILLION!

Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 12th Aug 2007 09:28
np.


http://www.freewebs.com/zornoxstudios/
Learning C++ thanks DGDK
Blobby 101
18
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 12th Aug 2007 09:54
pick object with objects.
make a button function with text - there is a good one with the rpg tutorial by xeno


thanks to deathead for the sig!
Projects: alien abductor-5%
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Aug 2007 21:34
Here's something I posted a moment ago about the same thing lol

Here is an example that show you can use sprites or images, and yes you can use bitmap art you just need to define an area for each object like I have done in this example:

The code isn't too great but it gives you an idea of how to do collision detection that isn't dependent on sprites (the cursor isn't a sprite).


The function takes the mouse position (px,py) and checks to see if this is inside the perimeter of the object (left,top,right,bottom), "res" is what is returned: if the mouse is inside the box the result is TRUE and res=1, if the mouse is outside the box it is FALSE and will return a 0.

Your signature has been erased by a mod because it was rubbish.
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 14th Aug 2007 02:34
Woo! People still use my tutorial in reference to programming!

I thought since TDK wrote some tutorials, no one even knew about mine anymore

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Aug 2007 21:00
Quote: "I thought since TDK wrote some tutorials, no one even knew about mine anymore"


Lol!

Actually Xen, I think the opposite is true!

As mine are all in DBC board stickies, no-one on the DBPro boards even knows they exist - even though they are equally for DBC and DBP.

This thought is enforced by the fact that many of my tutorials were written many years ago, yet you still see 'new' tutorials popping up on the DBPro boards which cover exactly the same subjects that mine do...

TDK_Man

Login to post a reply

Server time is: 2024-11-26 11:24:15
Your offset time is: 2024-11-26 11:24:15