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 / Buttons (getmousewhereabouty stuff)

Author
Message
The Ringmaster
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: Cyberspace
Posted: 18th Jul 2005 05:55
Hello. I would like to make a main menu for my Breakout clone. And menus need buttons. Unfortunately I am both incompetent and lazy so help would be appreciated .

In my experience, there are 2 types of buttons. Buttons which are activated by clicking the "down" key until the correct button highlights then pressing enter (I can do this), and ones where you click on them with the mouse (I cannot do this). I realise the seconde one has something to do with getting the mouse location and if it is over the button, wait till they click, if they dont do nothing. But I am too incompetent and lazy (As i have said before) to put all this into code.

HELP!

Clouds float the exact same way bricks don't
- Douglas Adams
Dangerous
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Toledo, OH
Posted: 18th Jul 2005 10:42
The Ringmaster,

Hope this code helps you. This code is good for 4 buttons and all the combos of those buttons while clicking. I am just going to put the code right here in the msg, I don't know how to do those snippets, maybe some one could tell me.


REM Project: Clickable Buttons
REM Created: 7/17/2005 7:04:33 PM
REM
REM ***** Main Source File *****
REM

set display mode 640,480,32
cls

sync on

rem load backgraound
load bitmap "Background.bmp",1

rem load buttons
load bitmap "a.bmp",2
get image 2,0,0,120,50
load bitmap "b.bmp",3
get image 3,0,0,120,50

ButtonX = 320
ButtonY = 240
ButtonXSize = (120/2)
ButtonYSize = (50/2)
MouseState = 0
sprite 2,ButtonX,ButtonY,2
offset sprite 2,ButtonXSize,ButtonYSize

do

copy bitmap 1,0,0,640,480,0,0,0,640,480
set current bitmap 0

MouseState = MouseClick()

if OverButton(ButtonX,ButtonY,ButtonXSize,ButtonYSize,MouseX(),MouseY())
sprite 2,ButtonX,ButtonY,3

select MouseState
case 0
center text 320,10,"No Click"
endcase
case 1
center text 320,10,"Left Click"
endcase
case 2
center text 320,10,"Right Click"
endcase
case 3
center text 320,10,"Right and Left CLick"
endcase
case 4
center text 320,10,"Third Button Pressed"
endcase
case 5
center text 320,10,"Right Click and Left Click"
endcase
case 6
center text 320,10,"Right Click and Third Button"
endcase
case 7
center text 320,10,"Left Click and Right Click and Third Button"
endcase
case 8
center text 320,10,"Fourth Button Pressed"
endcase
case 9
center text 320,10,"Left Click and Fourth Button"
endcase
case 10
center text 320,10,"Right Click and Fourth Button"
endcase
case 11
center text 320,10,"Left CLick and Right Click and Fourth Button"
endcase
case 12
center text 320,10,"Third Button and Fourth Button"
endcase
case 13
center text 320,10,"Left CLick and Third Button and Fourth Button"
endcase
case 14
center text 320,10,"Right Click and Third Button and Fourth Button"
endcase
case 15
center text 320,10,"ALL BUTTONS!!!!!!!!!!!!!!!"
endcase
endselect
else
sprite 2,ButtonX,ButtonY,2
endif

sync

loop

function OverButton(BX,BY,BW,BH,MX,MY)

ButtonState = 0

dx = abs(BX - MX)
dy = abs(BY - MY)

if (dx < BW)
if (dy < BH)
ButtonState = 1
endif
endif

endfunction ButtonState

If I am crazy, and the world is crazy, then I am normal.
Nytmayre
19
Years of Service
User Offline
Joined: 12th Jun 2005
Location: Induced Coma
Posted: 19th Jul 2005 01:51
Dangerous,

To do a snippet, all you have to do is click on the "code" button on the top right corner of the post window. copy/paste your code, then hit the code button again. Just ask if you wanna know how to...

a)insert piccies
b)make a quote
c)make a hyperlink/website addy

Hope I have been of assistance.

--NYTMAYRE--

An Eternal Struggle between good and evil continues...Each side looking for an advantage...Each side looking for me.

Uh... What's the point of this bit?
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 19th Jul 2005 05:12
Quote: "Hello. I would like to make a main menu for my Breakout clone. And menus need buttons. Unfortunately I am both incompetent and lazy so help would be appreciated."


I dont mean to come across as being rude, but hey...

You have posted two posts asking for help, showing no sign of initative or try. In both posts you have said you are too lazy to look yourself. Well I guess your honest! People will quickly stop giving you help if you keep saying you cant be arsed to do the work yourself. Im guessing your next post will be "I want to make the next final fantasy or halo but cant be arsed to code it, can you make it for me!!"

Hello!
The Ringmaster
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: Cyberspace
Posted: 19th Jul 2005 07:02
Well, since I have not been getting much help, I have been coding, and I have worked out how to do the buttons from the glossary. Here Is the breakout I have worked out so far (WITH BUTTONS)



Uh, note, It is in DBC. I have the maps in another file.

Clouds float the exact same way bricks don't
- Douglas Adams
The Ringmaster
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: Cyberspace
Posted: 19th Jul 2005 07:08
By the way, I want to make the next final fantasy or halo but cant be arsed to code it, can you make it for me!

Clouds float the exact same way bricks don't
- Douglas Adams
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 19th Jul 2005 08:40
Quote: "Im guessing your next post will be "I want to make the next final fantasy or halo but cant be arsed to code it, can you make it for me!!""



Quote: " By the way, I want to make the next final fantasy or halo but cant be arsed to code it, can you make it for me!
"


omfg rofl!!! if I went through every thread in this forum I would find a bunch of irritating, agitating, smart alic flame wars!! Lol but they are all funny. (Sorry, i just had to)

Any way, here is the button thing you needed :


*La la la* As easy as sunday mooorning!
Lol.

Enjoy Life while your still alive.
Enjoy a recees anytime!
The Ringmaster
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: Cyberspace
Posted: 19th Jul 2005 16:50
Thanx a bunch!

Clouds float the exact same way bricks don't
- Douglas Adams

Login to post a reply

Server time is: 2024-11-27 22:38:35
Your offset time is: 2024-11-27 22:38:35