Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Please Help with Panels/Visibility/Level_load #173095
12/16/07 18:59
12/16/07 18:59
Joined: Dec 2007
Posts: 8
A
arezxtreme Offline OP
Newbie
arezxtreme  Offline OP
Newbie
A

Joined: Dec 2007
Posts: 8
Okay, so I did the 24 part Lite-C Tutorial and figured i'd dive right in before I start all the other tutorials. I created some pretty nice panels, and such but here is my problem.


The Problem:

I have a menu that has the following buttons, Start, Load Game, Options, Quit.
My problem is with the start button. When I click start which is supposed to load the function start, and it does i'm sure because if I move the panel off center I can see the level load behind it. However, I want that as soon as I click the start button, the panel loses its visibility, however I can't do it because the start function comes before the panel is even defined and if I try ingame_panel1.flags &= ~VISIBLE I just get an undeclared, unless it is after the panel.

Question:
How can I get my panel to dissapear and my level to load when I click the start button?


Code:

///////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////

BMAP* ingame_bmap1 = "panel_main.tga"; // my first bmap
BMAP* mouse_pcx = "mouse.pcx"; // bitmap used for the mouse pointer

/////////////////////////////////////////////////////////////////////



function brightness()
{
video_gamma = 150;
while (video_gamma > 50)
{
video_gamma -= 1;
wait(-5);
}
}

function quit_program()
{
while (key_any)
{
wait (1);
}
sys_exit(NULL);
}



void load_game()
{
}

void options_main()
{
brightness();
}



function start_game()
{
level_load("rpg.wmb");
wait(2);

}




PANEL* ingame_panel1 = // my first panel
{
pos_x = 0;
pos_y= 0;
layer = 1;
bmap = ingame_bmap1;
flags = VISIBLE;
button (250, 335, "start_clicked.tga", "start_normal.tga", "start_over.tga", start_game, NULL, NULL);

button (250, 400, "load_clicked.tga", "load_normal.tga", "load_over.tga", load_game, NULL, NULL);

button (250, 465, "options_clicked.tga", "options_normal.tga", "options_over.tga", options_main, NULL, NULL);

button (250, 530, "quit_clicked.tga", "quit_normal.tga", "quit_over.tga", quit_program, NULL, NULL);
}

function main()
{
video_mode = 7;
screen_color.blue = 150;
mouse_mode = 1;


while (1)
{


mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}



*This is the version without the line "ingame_panel.flags &= ~VISIBLE because I don't know where to put it.

Re: Please Help with Panels/Visibility/Level_load [Re: arezxtreme] #173096
12/16/07 19:49
12/16/07 19:49
Joined: Dec 2007
Posts: 8
A
arezxtreme Offline OP
Newbie
arezxtreme  Offline OP
Newbie
A

Joined: Dec 2007
Posts: 8
I solved my own problem. I was just thinking to hard. All I had to do was use a global variable and check it Like this...


Code:

////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////

BMAP* ingame_bmap1 = "panel_main.tga"; // my first bmap
BMAP* mouse_pcx = "mouse.pcx"; // bitmap used for the mouse pointer

/////////////////////////////////////////////////////////////////////



function brightness() //increase brightness
{
video_gamma = 150;
while (video_gamma > 50)
{
video_gamma -= 1;
wait(1);
}
}

function quit_program()//quit to desktop from main menu
{
while (key_any)
{
wait (1);
}
sys_exit(NULL);
}



void load_game()//load saved game from main menu
{
}

void options_main()//edit options from main menu
{
brightness();
}

var check_start = 0;//variable to check if start is pressed

function start_game()//start game from main menu
{
level_load("rpg.wmb");
wait(2);
check_start = 1;


}




PANEL* ingame_panel1 = // my first panel
{
pos_x = 0;
pos_y = 0;
layer = 1;
bmap = ingame_bmap1;
flags = VISIBLE;
button (250, 335, "start_clicked.tga", "start_normal.tga", "start_over.tga", start_game, NULL, NULL);
button (250, 400, "load_clicked.tga", "load_normal.tga", "load_over.tga", load_game, NULL, NULL);
button (250, 465, "options_clicked.tga", "options_normal.tga", "options_over.tga", options_main, NULL, NULL);
button (250, 530, "quit_clicked.tga", "quit_normal.tga", "quit_over.tga", quit_program, NULL, NULL);
}

function main()
{
video_mode = 7; //set resolution
screen_color.blue = 150; //set screen background color
mouse_mode = 1; //set mouse mode



while (1) //cursor moves according how user positions mouse
{
if(check_start == 1)
{
ingame_panel1.flags &= ~VISIBLE;
}
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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