Posted: 28th Feb 2003 18:56
Here is a code for the menu that I made. Angelfire isn't working when i try to upload the screenshots so I can't put them here right now. I'll try some other time. In the menu, whatever is selected is on fire with a blue flame. It can uses the up and down arrow keys or the mouse. I haven't added anything to the options menu yet but it still opens up. When you open it, it displays the burning options at the top, you can add whatever you want there. If continue or quit is selected, it returns a 1 or a 2 respectively. The only thing that is wrong with it is that if you press the up or down keys rapidly, it pauses for a split second sometimes because of the animations. I took the animations from GIF's that i had and broke them down into 5 frames and the program cycles them as sprites. Also, the mouse over is just the slightest bit slow but i don't think it makes a difference. I haven't finished making it the easiest to read, i will probably post that later but i also want to take any suggestions to make it better or faster, except for making it easier to read. It's still pretty easy to read though. Enough talk, here's the snippet. It'll probably cut it off cause it never works on my first post so if it doesn't then i'll post it again.

sync on

Load Image "FirstGame\Seperate\Continue1.bmp",1
Load Image "FirstGame\Seperate\Continue2.bmp",2
Load Image "FirstGame\Seperate\Continue3.bmp",3
Load Image "FirstGame\Seperate\Continue4.bmp",4
Load Image "FirstGame\Seperate\Continue5.bmp",5
Load Image "FirstGame\Seperate\Options1.bmp",6
Load Image "FirstGame\Seperate\Options2.bmp",7
Load Image "FirstGame\Seperate\Options3.bmp",8
Load Image "FirstGame\Seperate\Options4.bmp",9
Load Image "FirstGame\Seperate\Options5.bmp",10
Load Image "FirstGame\Seperate\Quit1.bmp",11
Load Image "FirstGame\Seperate\Quit2.bmp",12
Load Image "FirstGame\Seperate\Quit3.bmp",13
Load Image "FirstGame\Seperate\Quit4.bmp",14
Load Image "FirstGame\Seperate\Quit5.bmp",15
Load Image "FirstGame\Continue2.bmp",16
Load Image "FirstGame\Options2.bmp",17
Load Image "FirstGame\Quit2.bmp",18

Dim continue(0)

MainMenu()
end

rem display main menu
Function MainMenu()
Anum=1
Do
PlayAnimationMain(Anum)
Open(Anum,Mouse)
rem if the mouse isn't being used then hide it
If mouse=0 then hide mouse
rem check for key presses
If downkey()=1
mouse=0
inc Anum
If Anum=4 then Anum=1
endif
If upkey()=1
mouse=0
dec Anum
If anum=0 then Anum=3
endif
rem if the mouse is being used then display it
rem but don't hide it unless the arrow keys are used
If MousemoveX()>0 or MousemoveY()>0 then mouse=1
if mouse=1
show mouse
Anum=MouseOver()
If Anum=0 then sync
endif
rem 1=continue 2=quit
If continue(0)=1 then exitfunction 1
If continue(0)=2 then exitfunction 2
Loop
Endfunction

rem play the animations for the main menu
Function PlayAnimationMain(ANum)
If Anum=1
Sprite 3,260,320,18
Sprite 2,235,220,17
For I=1 to 5
Sprite 1,225,110,I
Sync
sleep 20
rem interrupt it if key or mouse is pressed
rem but only do it once
If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
flag=1
exitfunction
else
flag=0
endif
Next I
else
rem if it isn't selected then display non-burning animation
Sprite 1,225,120,16
endif

rem do the same with the others
If Anum=2
Sprite 3,260,320,18
For I=6 to 10
Sprite 2,235,210,I
sync
sleep 20
If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
flag=1
exitfunction
else
flag=0
endif
Next I
else
Sprite 2,235,220,17
endif

If Anum=3
Sprite 1,225,120,16
For I=11 to 15
Sprite 3,260,310,I
sync
sleep 20
If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
flag=1
exitfunction
else
flag=0
endif
Next I
else
Sprite 3,260,320,18
endif

Endfunction

rem check if mouse is over one of the images
Function MouseOver()
For sn=1 to 3
If MouseX()>Sprite x(sn) and MouseX()Sprite Y(sn) and MouseY()
Posted: 28th Feb 2003 18:58
Yup, i was right, it didn't post as a snippet. Here it is again.

+ Code Snippet
sync on

Load Image "FirstGame\Seperate\Continue1.bmp",1
Load Image "FirstGame\Seperate\Continue2.bmp",2
Load Image "FirstGame\Seperate\Continue3.bmp",3
Load Image "FirstGame\Seperate\Continue4.bmp",4
Load Image "FirstGame\Seperate\Continue5.bmp",5
Load Image "FirstGame\Seperate\Options1.bmp",6
Load Image "FirstGame\Seperate\Options2.bmp",7
Load Image "FirstGame\Seperate\Options3.bmp",8
Load Image "FirstGame\Seperate\Options4.bmp",9
Load Image "FirstGame\Seperate\Options5.bmp",10
Load Image "FirstGame\Seperate\Quit1.bmp",11
Load Image "FirstGame\Seperate\Quit2.bmp",12
Load Image "FirstGame\Seperate\Quit3.bmp",13
Load Image "FirstGame\Seperate\Quit4.bmp",14
Load Image "FirstGame\Seperate\Quit5.bmp",15
Load Image "FirstGame\Continue2.bmp",16
Load Image "FirstGame\Options2.bmp",17
Load Image "FirstGame\Quit2.bmp",18

Dim continue(0)

MainMenu()
end

rem display main menu
Function MainMenu()
Anum=1
Do
   PlayAnimationMain(Anum)
   Open(Anum,Mouse)
   rem if the mouse isn't being used then hide it
   If mouse=0 then hide mouse
   rem check for key presses
   If downkey()=1
      mouse=0
      inc Anum
      If Anum=4 then Anum=1
   endif
   If upkey()=1
      mouse=0
      dec Anum
      If anum=0 then Anum=3
   endif
   rem if the mouse is being used then display it
   rem but don't hide it unless the arrow keys are used
   If MousemoveX()>0 or MousemoveY()>0 then mouse=1
   if mouse=1
      show mouse
      Anum=MouseOver()
      If Anum=0 then sync
   endif
   rem 1=continue 2=quit
   If continue(0)=1 then exitfunction 1
   If continue(0)=2 then exitfunction 2
Loop
Endfunction

rem play the animations for the main menu
Function PlayAnimationMain(ANum)
If Anum=1
   Sprite 3,260,320,18
   Sprite 2,235,220,17
   For I=1 to 5
      Sprite 1,225,110,I
      Sync
      sleep 20
      rem interrupt it if key or mouse is pressed
      rem but only do it once
      If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
         flag=1
         exitfunction
      else
         flag=0
      endif
   Next I
else
   rem if it isn't selected then display non-burning animation
   Sprite 1,225,120,16
endif

rem do the same with the others
If Anum=2
   Sprite 3,260,320,18
   For I=6 to 10
      Sprite 2,235,210,I
      sync
      sleep 20
      If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
         flag=1
         exitfunction
      else
         flag=0
      endif
   Next I
else
   Sprite 2,235,220,17
endif

If Anum=3
   Sprite 1,225,120,16
   For I=11 to 15
      Sprite 3,260,310,I
      sync
      sleep 20
      If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
         flag=1
         exitfunction
      else
         flag=0
      endif
   Next I
else
   Sprite 3,260,320,18
endif

Endfunction

rem check if mouse is over one of the images
Function MouseOver()
For sn=1 to 3
   If MouseX()>Sprite x(sn) and MouseX()<Sprite x(sn)+sprite width(sn)
   If MouseY()>Sprite Y(sn) and MouseY()<Sprite Y(sn)+sprite height(sn)
   Exitfunction sn
   endif
   endif
Next sn
   sn=0
Endfunction sn

rem open one of the menus if you need to
Function Open(Anum,Mouse)
rem always continue whenever return key is pressed
If Returnkey()=1
   continue(0)=1
   exitfunction
endif
If (Mouse=0 and Spacekey()=1) or (Mouse=1 and MouseClick()=1)
   Select Anum
      Rem no need to call a function for continue or quit
      Case 1
         continue(0)=1
         exitfunction
      endcase
      Case 2
         Options()
         exitfunction
      endcase
      Case 3
         continue(0)=1
         exitfunction
      endcase
   endselect
endif
Endfunction

rem display the options menu
Function Options()
rem delete other images
   for c=1 to 5
      delete image c
   next c
   for c=11 to 15
      delete image c
   next c
   delete image 16
   delete image 18
   Do
      PlayAnimationsOptions()
      sync
   Loop
Endfunction

rem play animations for options menu
Function PlayAnimationsOptions()
For I=6 to 10
   Sprite 2,235,10,I
   Sync
   sleep 20
   If (downkey()=1 or upkey()=1 or spacekey()=1 or Returnkey()=1 or Mouseclick()=1) and flag=0
      flag=1
      exitfunction
   else
      flag=0
   endif
Next I
Endfunction


I will probably break it up into more functions for readability later. Again, any suggestions are welcome, Thanks
Posted: 1st Mar 2003 12:59
hi, my menu code is a lot simpler than that,

http://www.macrosoft.v-2-1.net/menu.zip
Posted: 1st Mar 2003 13:37
Maybe include the media files next time, because Im sure the graphics add alot to your menu. Or alternativly make one without any bitmaps!!!
Posted: 1st Mar 2003 15:52
play sprite would reduce your code and make it simpler.
Posted: 2nd Mar 2003 0:26
Yeah benny that is simpler but mine also has more features, animation, key input + mouse input, you can add more sub menus easier too without having to redo a whole background image. I just wanted to make a map with lots of features. I'm a noobie and i just wanted to see what i could do. Nice job on yours though. Very simple and easy to implement
Posted: 2nd Mar 2003 0:29
By the way, I've got classic. Not Pro. I don't think there is a play sprite in classic
Posted: 3rd Mar 2003 0:19
you can do sprites in db1, and mine is alot simpler mainly because its my first ever contribution to any computer game.
my team, working under sorcre900 is trying to make an fps.
Posted: 4th Mar 2003 22:55
Yeah, i know that there are sprites but is there a 'play sprite' command?
Posted: 8th Mar 2003 15:06
look in your manual...
Posted: 8th Mar 2003 16:09
open DB

type it

highlight it

press f1
Posted: 9th Mar 2003 20:56
yeah, that's not working. It says that it doesn't recognize it. Before, i meant to say DB Lite not the full version of classic but i thought that it was the exact same but you just couldn't compile it into an exe.
Posted: 19th May 2003 2:04
I finally got the pictures of the menu uploaded:




the second one is the options menu, that's just the setup for it. I don't have a need for one in my game as of yet so i didn't do anything with it.

Sorry it took so long