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 / Help on Mouse Click

Author
Message
ROL
21
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 17th Jun 2003 21:43
I need help on selecting images with the mouse.
Thank you to all who reply.
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 18th Jun 2003 07:16
you need your question to be a little more descriptive... but what i think you are getting at is how do i use mouseclick(), mousex(), and mousey() to select an image when i click the image on the screen... this may or may not be what you wan't but if it is try something like...

if mouseclick()=1 and mousex() <= [width of image + x position of image] and mousex() >= [x position of image]
if mousey() <= [height of image + y position of image] and mousey() >= [y position of image]

...code goes here...

endif
endif

so if your image was 10 pixels wide and 20 pixels high and it was positiond at 0,0 (0=x and 0=y) then the code would read...

if mouseclick()=1 and mousex() <= 10 and mousex() >= 0
if mousey() <= 10 and mousey() >= 0

endif
endif

well... it's not tested but it should work... if this is what you wanted then i hope it helps...

Anyone Can Destroy...But Few Can Create...
ROL
21
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 18th Jun 2003 13:01
Yes it does work, and it was what i was looking for.

Thank you

ROL
21
Years of Service
User Offline
Joined: 17th Jun 2003
Location:
Posted: 18th Jun 2003 13:06
I got another question for you, now how do i tell it to goto a location after i select the image.

thank you for all who help

sorry if its not descriptive, im a little tired.

Nilrem
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 18th Jun 2003 17:03
What to go to another location? The image or your mouse pointer, or even something else?

I hear and I forget. I see and I remember. I do and I understand.
Bloodshot
21
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United Kingdom
Posted: 18th Jun 2003 17:52 Edited at: 18th Jun 2003 17:53
If you want your image to follow your mouse, like it's attached to it:

Sprite SPRITENUMBER, MouseX(), MouseY(), IMAGENUMBER
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 18th Jun 2003 20:51 Edited at: 18th Jun 2003 20:53
do you mean to have it warp to another section of code??? or to move the image to another location of the screen??? if it's the first one try...

if mouseclick()=1 and mousex() <= [width of image + x position of image] and mousex() >= [x position of image]
if mousey() <= [height of image + y position of image] and mousey() >= [y position of image]
...code...
goto [LabelName]
endif
endif
...morecode...
[LabelName]:
...evenmorecode...

...or if it's the second one try...

paste image [image number],[new x position],[new y position]

...remember there are several methods for programming something... like if you are using sprites instead of just pasteing image, use BloodShot's code...

Sprite [sprite number], [new x position], [new y position], [image number]

...and like i said before, you do need to be more descriptive about your question...it will help us and you out alot...well...i hope that also helps...

Anyone Can Destroy...But Few Can Create...

Login to post a reply

Server time is: 2024-11-24 18:25:09
Your offset time is: 2024-11-24 18:25:09