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.

Author
Message
DeathToll
20
Years of Service
User Offline
Joined: 30th Mar 2005
Location: Kamino or whatever.
Posted: 27th Apr 2005 11:47
i'm working on a game and i can't figure out how to make 2d buttons that work when you click on them with the mouse.

i want them to be words that light up when you put the mouse over it, and that can make a sound when you click it.

any help? this is for the main menu of my game

NEW GAME
LOAD
SETTINGS
EXIT
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 27th Apr 2005 23:15
What are you doing so far? What precisely are you having trouble with?

Your question is kinda like saying "I got in a car and I cant get it to work!!"

My Website:
HowDo
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Apr 2005 23:23 Edited at: 27th Apr 2005 23:34
With 2D, are you meaning you have load an image of the buttons you wish to be clicked, or you pasted some sprites on the screen.

lets us know which as both ways of doing it are on here to pointed to or shown.

also try this tread http://forum.thegamecreators.com/?m=forum_view&t=51932&b=7

In Space No One can Hear You Scream! (When your comm Line is cut?)
HowDo
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Apr 2005 03:54
have some code but it may not be easy to understand,
but have a look, and if some else can make easier to understand there welcome.

1. you will need a no glow image
2. you will need five other image of the above but with each on highlighting a diffrent menu option.
3. new x y length and depth cords



hope this helps and not the heck out of you.

In Space No One can Hear You Scream! (When your comm Line is cut?)
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 28th Apr 2005 04:10
Theres a program called ButtonMania that will let you create buttons, which you can then use in DBPro.

Visit http://homepages.nildram.co.uk/~nickk
Calm down dear! Its only an election...
games coder
20
Years of Service
User Offline
Joined: 2nd Feb 2005
Location:
Posted: 28th Apr 2005 07:07
If you want to make your own buttons, create a sprite for each, as well as a very small sprite at the position of the mouse cursor. When the user clicks, check if the sprite under the mouse is intersecting with any other sprites, if it is, you can play a sound or whatever else you need to do. Here is some pseudo:

do
make button sprites

place sprite at mouse x,y
for button = 1 to # of buttons
did intersection happen between this and mouse sprite?
switch sprite image to glow image
if mouseclick()=1 then perform action (sound, etc.)
next button

other code...
loop

[insert signature here]
DeathToll
20
Years of Service
User Offline
Joined: 30th Mar 2005
Location: Kamino or whatever.
Posted: 5th May 2005 10:14
sorry it took me so long to reply again.

Quote: "When the user clicks, check if the sprite under the mouse is intersecting with any other sprites, if it is, you can play a sound or whatever else you need to do"


that's exactly what i need help with. i can't figure out how to sense an object under the mouse.

that link that HowDo gave me helped though. thanks man.

Login to post a reply

Server time is: 2025-06-04 17:48:39
Your offset time is: 2025-06-04 17:48:39