1 registered members (AndrewAMD),
1,369
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Can't figure out how to remove a panel
#349105
12/04/10 01:39
12/04/10 01:39
|
Joined: Nov 2010
Posts: 21
elegant_mistake
OP
Newbie
|
OP
Newbie
Joined: Nov 2010
Posts: 21
|
Hi everybody.
I'm adding some things to the "wizard duel" game from the LiteC tutorials.
I added a panel (pTest_pan) with a button that appears before the game. The button must be clicked to start the game.
I can't figure out how to remove the panel and button after the game has started. They stay on the screen.
I tried "ptr_remove" and reset(pTest_pan, SHOW) to no success. Am I missing something really simple?
Thanks for all your help by the way. I am learning 3dgs quickly thanks to all of you.
Last edited by elegant_mistake; 12/04/10 01:43.
I need to come up with a better signature
|
|
|
Re: Can't figure out how to remove a panel
[Re: elegant_mistake]
#349118
12/04/10 04:13
12/04/10 04:13
|
Joined: Nov 2010
Posts: 21
elegant_mistake
OP
Newbie
|
OP
Newbie
Joined: Nov 2010
Posts: 21
|
Thanks man, but I'm still doing something wrong. I get undeclared identifier errors when I compile it. I guess I'll try again tomorrow.
Here is the relevant section of my code if anybody wants to give some advice, but no big whoop either way.
p.s. What's the best way to post code on the forums?
function main() { screen_size.x = 800; screen_size.y = 600; screen_color.blue = 150; mouse_mode = 4; PANEL* pTest_pan = { bmap = "main.pcx"; pos_x = 250; pos_y = 200; button(100, 100, start_button.bmp, start_button.bmp, start_button.bmp, game, null, null); flags = OVERLAY | SHOW; } }
function game() { pTest_pan.flags &= ~SHOW; level_load("shooter.wmb"); while(1) { if(winner == 1) draw_text("Well done! Red wins!", 10, 10, vector(50, 50, 255)); else if(winner == 2) draw_text("Ouch! Green wins!", 10, 10, vector(50, 255, 50)); wait(1); } }
Last edited by elegant_mistake; 12/04/10 04:14.
I need to come up with a better signature
|
|
|
Re: Can't figure out how to remove a panel
[Re: elegant_mistake]
#349150
12/04/10 12:31
12/04/10 12:31
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Why is your PANEL definition inside the main function?! That's why your identifier (pTest_pan) is unknown in your game function. Use [code ] and [/code ] without the spaces to post code.
PANEL* pTest_pan =
{
bmap = "main.pcx";
pos_x = 250;
pos_y = 200;
button(100, 100, start_button.bmp, start_button.bmp, start_button.bmp, game, null, null);
flags = OVERLAY | SHOW;
}
function main()
{
screen_size.x = 800; screen_size.y = 600; screen_color.blue = 150;
mouse_mode = 4;
}
function game()
{
pTest_pan.flags &= ~SHOW;
level_load("shooter.wmb");
while(1)
{
if(winner == 1)
draw_text("Well done! Red wins!", 10, 10, vector(50, 50, 255));
else if(winner == 2)
draw_text("Ouch! Green wins!", 10, 10, vector(50, 255, 50));
wait(1);
}
}
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: Can't figure out how to remove a panel
[Re: Superku]
#349179
12/04/10 17:29
12/04/10 17:29
|
Joined: Nov 2010
Posts: 21
elegant_mistake
OP
Newbie
|
OP
Newbie
Joined: Nov 2010
Posts: 21
|
Hey thanks. That made it work. Now I am slightly less retarded than I was yesterday. This is a good thing.
I need to come up with a better signature
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|