Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 04/25/26 16:09
Z9 getting Error 058
by jcl. 04/24/26 17:48
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (TipmyPip, Grant), 3,389 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 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