2 registered members (AndrewAMD, TipmyPip),
12,709
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
calling panel & function from the previous script
#357232
02/06/11 09:41
02/06/11 09:41
|
Joined: Sep 2010
Posts: 97
carla_mariz
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 97
|
hi, can anyone help me with this problem?? i have a game and i want it to go back to the menu when it is game over. the menu code and the level code are separated, so the level code is included at the menu code: "#define level1.c". when i include level1.c to the menu code, there is an error. all panels declared to the level1.c is visible and overlays to the menu code when i run the script although it is set to ~SHOW in menu code. what should i do? pls help me. thanks 
|
|
|
Re: calling panel & function from the previous script
[Re: carla_mariz]
#357315
02/06/11 17:09
02/06/11 17:09
|
Joined: Jan 2011
Posts: 120 United States
Logan
Member
|
Member
Joined: Jan 2011
Posts: 120
United States
|
So you're saying you have switched OFF all the panels from level1.c within the menu code? And this is still happening? My first guess is maybe you have a while() loop somewhere in the level code that is switching the panels on every frame, and for whatever reason it's not stopping when the menu comes up. In that case just add a simple if(is(menu,SHOW)) break; to the loop. That's just a guess though. That's probably the mistake I would have made.  Sometimes the most remote lines in the tiniest parts of your code causes massive problems. I'd do an Edit>Find in SED to find every occurrence of the panel names, to see if you are switching them on at wrong times.
|
|
|
Re: calling panel & function from the previous script
[Re: carla_mariz]
#357397
02/06/11 23:16
02/06/11 23:16
|
Joined: Sep 2010
Posts: 97
carla_mariz
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 97
|
hi, when i include level1.c to the menu code, there is an error. all panels declared to the level1.c is visible and overlays to the menu code when i run the script although it is set to ~SHOW in menu code. what should i do? pls help me. thanks sorry, what i want to say here was, "when i include menucode.c to the level1.c"  ~the reason why i include menucode.c to the level1.c is to call the menu panel so that the user can play again or exit. 
|
|
|
Re: calling panel & function from the previous script
[Re: Logan]
#357414
02/07/11 01:09
02/07/11 01:09
|
Joined: Sep 2010
Posts: 97
carla_mariz
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 97
|
here, this is the menu code:
#include <acknex.h>
#include <default.c>
#include "level1.c"
.
.
.
PANEL* logoscreen =
{
layer = 2;
bmap = men1;
pos_x = 0;
pos_y = 0;
button (287, 167, "sot.tga", "sot.tga", "sov.tga", lvl_load, NULL, overmenuitem);
button (287, 215, "lanot.tga", "lanot.tga", "lanov.tga", NULL, NULL, overmenuitem);
button (287, 263, "optot.tga", "optot.tga", "optov.tga", options, NULL, overmenuitem);
button (287, 311, "insot.tga", "insot.tga", "insov.tga", instruct, NULL, overmenuitem);
button (287, 359, "abot.tga", "abot.tga", "abov.tga", NULL, NULL, overmenuitem);
button (287, 407, "exot.tga", "exot.tga", "exov.tga", is_exit_prg, NULL, overmenuitem);
flags = SHOW | OVERLAY;
}
.
.
.
function main()
{
screen_size.x = 800;
screen_size.y = 600;
mouse_map = cur;
mouse_mode = 4;
master_vol = 75;
soundtrack_handle = media_loop("Pacman.mp3", NULL, soundtrack_volume);
options_pan.flags &= ~SHOW;
level2_pan.flags &= ~SHOW;
ins_pan.flags &= ~SHOW;
exit_pan.flags &= ~SHOW;
logoscreen.flags &= ~SHOW;
selectchar.flags &= ~SHOW;
q1.flags &= ~SHOW;
health_pan.flags &= ~SHOW;
gameover.flags &= ~SHOW;
score_gameover.flags &= ~SHOW;
tme_up.flags &= ~SHOW;
gui.flags &= ~SHOW;
radar_screen.flags &= ~SHOW;
level1_pan.flags &= ~SHOW;
congrats_pan.flags &= ~SHOW;
scoret.flags &= ~SHOW;
splashout();
}
.
.
.
and this is the level1 code:
#include <acknex.h>
#include <default.c>
#define health skill1
#define state skill2
PANEL* level2_pan =
{
bmap = "level2.jpg";
pos_x = 0;
pos_y = 0;
layer = 40;
flags = SHOW;
}
PANEL* q1 =
{
bmap = "q1.pcx";
layer = 4;
pos_x = 580;
pos_y = 10;
flags = SHOW | TRANSLUCENT;
}
PANEL* radar_screen=
{
BMAP = "dark1.bmp";
flags = SHOW | TRANSLUCENT;
pos_x=5;
pos_y=5;
layer = 0;
alpha = 95;
}
PANEL* tme_up =
{
bmap = "times.pcx";
pos_x = 0;
pos_y = 0;
flags = SHOW | TRANSLUCENT;
alpha = 85;
}
PANEL* congrats_pan =
{
bmap = "ans1.pcx";
layer = 4;
pos_x = 580;
pos_y = 10;
flags = SHOW;
}
PANEL* health_pan =
{
bmap = "hbar.pcx";
pos_x = 10;
pos_y = 550;
layer = 25;
flags = SHOW;
}
PANEL* gameover =
{
bmap = "gameover.pcx";
pos_x = 0;
pos_y = 0;
flags = SHOW | TRANSLUCENT;
alpha = 85;
}
PANEL* time_txt =
{
digits(20, 250, 3, "Arial#24b", 1, time_str);
flags = SHOW;
}
PANEL* gui =
{
digits(570, 550, 1, "Arial#24bi", 1, players_life);
digits(740, 550, 2, "Arial#24bi", 1, players_score);
digits(780, 550, 2, "Arial#24bi", 1, total_power);
flags = SHOW;
}
PANEL* scoret =
{
bmap = "score.tga";
pos_x = 0;
pos_y = 0;
layer = 0;
button = (350, 450, "Lokot.tga", "Lokot.tga", "Lokov.tga", level2, NULL, overmenuitem);
digits(550, 182, 9, "Arial#24bi", 1, a);
digits(400, 182, 9, "Arial#24bi", 1, players_score);
digits(550, 230, 9, "Arial#24bi", 1, b);
digits(400, 230, 9, "Arial#24bi", 1, players_diamond);
digits(550, 280, 9, "Arial#24bi", 1, c);
digits(550, 320, 9, "Arial#24bi", 1, total);
flags |= SHOW;
}
PANEL* score_gameover =
{
bmap = "score.tga";
pos_x = 0;
pos_y = 0;
layer = 0;
button = (350, 450, "Lokot.tga", "Lokot.tga", "Lokov.tga", mmenu, NULL, overmenuitem);
digits(550, 182, 9, "Arial#24bi", 1, a);
digits(400, 182, 9, "Arial#24bi", 1, players_score);
digits(550, 230, 9, "Arial#24bi", 1, b);
digits(400, 230, 9, "Arial#24bi", 1, players_diamond);
digits(550, 280, 9, "Arial#24bi", 1, c);
digits(550, 320, 9, "Arial#24bi", 1, total);
flags |= SHOW;
}
function mmenu()//the function where i want to call the logoscreen panel
{ //from the menu code.
//logoscreen.flags |= SHOW;
}
whenever i include menucode.c in the level1.c, an error saying that the panels from level1.c are unidentified. btw, the first code to run is the main menu code. 
|
|
|
|