Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,420 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Keyword menu #181120
01/31/08 12:00
01/31/08 12:00
Joined: Jun 2007
Posts: 63
Italy
Sonic220 Offline OP
Junior Member
Sonic220  Offline OP
Junior Member

Joined: Jun 2007
Posts: 63
Italy
Hi guys, i'm trying to create a simple menu, that's the code.
Code:
 panel main_pan
{
layer = 1;
pos_x = 0;
pos_y = 0;
button = 300, 550, exit, exit, exit, null, null, null;
button = 300, 515, options, options, options, null, null, null;
button = 300, 480, newgame, newgame, newgame, null, null, null;
flags = overlay, refresh, visible;
}
panel selection1_pan
{
layer = 1;
bmap = selection_tga;
pos_x = 300;
pos_y = 480;
flags = overlay, refresh, visible;
}

panel selection2_pan
{
layer = 1;
bmap = selection_tga;
pos_x = 300;
pos_y = 512;
flags = overlay, refresh, visible;
}

panel selection3_pan
{
layer = 1;
bmap = selection_tga;
pos_x = 300;
pos_y = 550;
flags = overlay, refresh, visible;
}
fuction selection()
{
if(select == 0){
selection1_pan.visible = on;
selection2_pan.visible = off;
selection3_pan.visible = off;
}
if(select == 1){
selection1_pan.visible = off;
selection2_pan.visible = on;
selection3_pan.visible = off;
}
}
function main()
{
fps_max = 50;
level_load (intro_wmb);
sleep (5);
time_smooth = 0.9;
}
if(key_cuu == on && select >= 0){
select += 1;
}
if(key_cud == on && select <= 2){
select -= 1;
}
selection();
}



The compiler tell me there is an error, why this code isn't good?
Someone have an example of a keyword menu or there is as aum?

Thx all for the answer.

Last edited by Sonic220; 01/31/08 12:01.

~Vision Divine~
Re: Keyword menu [Re: Sonic220] #181121
01/31/08 15:11
01/31/08 15:11
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Code:

function main()
{
fps_max = 50;
level_load (intro_wmb);
sleep (5);
time_smooth = 0.9;
} // remove this bracket!
if(key_cuu == on && select >= 0){
select += 1;
}
if(key_cud == on && select <= 2){
select -= 1;
}
selection();
}



The ifs in the main function do not make much sense.
It seems there should be a while-loop around them.

edit:
Even better would be two key functions:
Code:

function menu_selectionUp()
{
select = cycle(select+1,0,2);
selection();
}

function menu_selectionDown()
{
select = cycle(select-1,0,2);
selection();
}

function main()
{
fps_max = 50;
level_load (intro_wmb);
sleep (5);
time_smooth = 0.9;

on_cuu = menu_selectionUp;
on_cud = menu_selectionDown;
}



Last edited by Xarthor; 01/31/08 15:17.

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1