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.

DarkBASIC Discussion / Clickable button idea

Author
Message
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 13th Sep 2005 03:18

What this does, is place a sprite at mousex() and mousey() when you click. It checks for collision, and if collision then goto wherever.
It dosnt work. Can anyone tell me why?

Read Ender's Game. And all its sequals.
P Schnell
20
Years of Service
User Offline
Joined: 13th Feb 2005
Location:
Posted: 13th Sep 2005 03:59
Are you trying to check for collision with the mouse? Because the mouse doesn't act as a sprite collision wise.

And you really shouldn't be creating a sprite every loop, just make it once and keep it there.

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 13th Sep 2005 04:10 Edited at: 13th Sep 2005 04:10
You cold try this (please note I haven't tried it yet, just a theory)



------------------------
Visit my website of games
http://www.dabip.co.nr!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Sep 2005 04:51 Edited at: 13th Sep 2005 04:52
You only need a 2x2 sprite at the tip of the mouse (hidden) and check for that sprite. If you check the whole mouse sprite then it'll show up as a hit even if the tail is touching the button.

Hope this helps.

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 13th Sep 2005 17:51
Well, oh! I get what you're saying. I just used a "fake" mouse but that would work also! Good job!

------------------------
Visit my website of games
http://www.dabip.co.nr!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Sep 2005 00:31
Thanks
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Sep 2005 11:55


Note: This only works with square sprites...

Immunity and Annihalation makes Immunihalation...
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Sep 2005 18:47 Edited at: 16th Sep 2005 18:53
Quote: "Note: This only works with square sprites..."


No need for a sprite at all with that code. It could be any X/Y position. Personally, it is best to take advantage of DBClassics pixel perfect collision routines when clicking a sprite as a button. Otherwise you use a zone, which is what you have posted there, but without a sprite involved.

Robot
20
Years of Service
User Offline
Joined: 27th May 2004
Location:
Posted: 16th Sep 2005 20:01
I used the sprite button method here
http://forum.thegamecreators.com/?m=forum_view&t=52494&b=11

The happenings of tommorow are behind us now

Login to post a reply

Server time is: 2025-05-22 08:36:54
Your offset time is: 2025-05-22 08:36:54