Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/27/26 16:40
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (TipmyPip, Quad, AndrewAMD, Grant), 5,025 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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