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.

2D All the way! / 2D Menu thingy

Author
Message
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 31st Jan 2004 01:34
im working on a little project (its not really game) and i need to know if there are any tuts for making graghical menu screens type things. unfurtunity the manual that comes with DBC sucks

I am god, now bow before me you stupid peasants
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 31st Jan 2004 05:52 Edited at: 31st Jan 2004 05:52
Hi Teckno,
The manual does kind of...well..suck. Basically the hardest part of making a menu is designing it, and then drawing all the buttons and graphics. Most menus have a background image like a logo, title, and cool stuff like that. Then it has a bunch of buttons drawn as sprites. Here's some pseudo:

If the cursor sprite overlaps the button sprite
..........if the mouse is clicked then load game, or open next menu

If you need anymore just keep asking,
crazy donuts

Juvenile Industries
Current Project: KillZone(FPS)
Soon to come:An rts, and a snowball fight game
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Jan 2004 12:58
Will this help you get started?




"eureka" - Archimedes
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 31st Jan 2004 22:10
Im working on the graphics now, im just having problems with the code, i.e. how to make the program see when i click on a button and how to make it move to the next screen.

plaelax: nice code, but im not looking to use dropdown menus. Im gonna save the code anyway for when I do need them

also, I guess I should mention im using Dark Basic Classic

I am god, now bow before me you stupid peasants
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Feb 2004 02:32
Well clickable buttons is a topic covered just below yours.

http://www.thegamecreators.com/?m=forum_view&t=24163&b=4

A button is covered by an invisible rectangle of X/Y coordinates. It is easy to check if the mouse pointer passes over this rectangle. The invisible rectangles are called zones. That is the method, covered in the link, and it has snippets. You can also use sprites as buttons, and you can use sprite collision as an indication that the mouse pointer is touching a button. Then you wait for a mouse click. Your menu could be in a subroutine called....Menu:



Your main loop...

Do

Gosub Menu
Gosub Game

Loop

menu:

Return

In the menu, you put a zone that waits for a mouse click.
You then allow the program to continue. It reaches the Return, and you are now into the game.

Pincho.

Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 1st Feb 2004 19:49
Ok, im going with the overlapping sprite idea but not im getting a runtime error that says "Bob does not exist" it always points me to the line of code where my sprite collision() thingy is. who the hell is Bob?

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Feb 2004 20:41
A bob is another name for a sprite, it came from the Amiga, and means Blitter Object. It is actually a false name on a PC because the PC does not have a Blitter Chip, and does not have Blitter Objects as far as I know.

Pincho.

Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 1st Feb 2004 20:55
ok, but the sprite does exsist, what could be wrong?

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Feb 2004 00:39
You could be doing something to the sprite before you have made it. Anything before the Sprite command can cause an error. My computer will ofter crash if I try to set sprite before I use Sprite

Pincho.

Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 2nd Feb 2004 20:41 Edited at: 2nd Feb 2004 20:44
ok, i found the problem. I got my sprite numbers and my image numbers mixed up, I feel so stupid. anyway i got that fixed and evil bob is gone, but now my IF THEN thing doesnt work. I click and nothing happens. heres the code:



I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Tersaken
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: France ( Rennes )
Posted: 2nd Feb 2004 21:21 Edited at: 2nd Feb 2004 21:23


Now, it works
But Beware, you should better structure your program !

Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 2nd Feb 2004 21:50
Thanks, I know its a bit of a mess, but how should i structure it? any tips?

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Tersaken
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: France ( Rennes )
Posted: 2nd Feb 2004 21:52
One tip => The Functions or Labels

Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 2nd Feb 2004 22:00
I just tried the code and i relized that you removed sprite 2, which is the button. how can i click on a button if there is no button?

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 2nd Feb 2004 22:05
Quote: "One tip => The Functions or Labels "


once i get the code to work ill make it a function, then on to the next bit of code, which will become a funtion and so on.

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Tersaken
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: France ( Rennes )
Posted: 2nd Feb 2004 22:10
Ok; so Good Luck

Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 2nd Feb 2004 22:17
but how can i get the code to work with Sprite 2???

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Tersaken
20
Years of Service
User Offline
Joined: 15th Dec 2003
Location: France ( Rennes )
Posted: 2nd Feb 2004 22:35
Oups sorry, it's a Mistake !

Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 3rd Feb 2004 02:31
I tried reinserting the line of code but its still not working

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 3rd Feb 2004 19:27
Cant anyone Help me??

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Feb 2004 05:15
To do different size buttons, you could use a code snippet from UW's website. The "point in a poly" function.

"eureka" - Archimedes
Teckno
20
Years of Service
User Offline
Joined: 20th Jan 2004
Location: Inside of your computer, LET ME OUT!!!!!
Posted: 4th Feb 2004 19:04
nevermind, I found the problem. there was somting wrong with the mouse sprite. once again, I feel so stupid. but thanks for all your help

I am god, now bow before me you stupid peasants
I accept no responsibility for any thing I say while... well..... ever

Login to post a reply

Server time is: 2024-05-13 14:20:02
Your offset time is: 2024-05-13 14:20:02