1 registered members (AbrahamR),
717
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Fading panel problem.
#331094
07/01/10 21:11
07/01/10 21:11
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
Hello, o already posted this on the bug section, but i would like you guys to check this. you can download the file here: GO TO BUG SECTION LINK or you can read the code here.
#include <acknex.h>
#include <default.c>
#include <litec.h>
BMAP* c_map;
function fade_pan_out(PANEL*p){
set(p,TRANSLUCENT); //Allow alpha
while(p.alpha>0){
p.alpha-=20*time_step;
wait(1);
}
///After faded, make it invisible
p.alpha=0;set(p,UNTOUCHABLE);reset(p,SHOW);
}
function load_wait(short a, short b, var time){
PANEL* ar=pan_create("bmap=c_map;",5);
var timex=0;
set(ar,SHOW);
ar.pos_x=a;ar.pos_y=b;
while(timex<time){wait(1); timex++;}
//reset(ar,SHOW); //switch with fade , and it wont happen again
fade_pan_out(ar); //remove the panel , <<<<<<<< this is one thing that causes a "bug" to dissapear "no related" further panels.
ptr_remove(ar); //remove the local created panel pointer
}
PANEL* addd_pan;
function add_contact_start2(){addd_pan=pan_create("bmap=c_map; pos_x=100; pos_y=50;flags=SHOW;",4);}
function main(){
vec_set(screen_color,vector(53,53,53));
video_window(NULL,NULL,16,"TEST");
video_set(800,600,0,0);
level_load(NULL);
wait(1);
reset(camera,SHOW);
c_map=bmap_createblack(100,100,32); //something to just show
wait(1);
bmap_fill(c_map,vector(100,200,100),100);
wait(1);
//real script
load_wait(300,300,100); //waits 200 to fade out, and when over , keep this function bellow.
wait_for(load_wait);
add_contact_start2(); //create a new panel...
}
Like JCl said there is timming problem with the fade out, and then ptr remove (which wont wait for the fade out function) but that is not reason to fade the 2nd panel anyway
Last edited by MMike; 07/01/10 21:15.
|
|
|
Re: Fading panel problem.
[Re: Lukas]
#331102
07/01/10 21:24
07/01/10 21:24
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
The pointer will change when the remove function runs...
edit: lukas was faster...
Last edited by Rei_Ayanami; 07/01/10 21:24.
|
|
|
Re: Fading panel problem.
[Re: SchokoKeks]
#331111
07/01/10 22:22
07/01/10 22:22
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
so when i remove the first panel, it will affect the second panel pointer that was created external to all this, and that will "assign a function" to that second panel that is fade out. never though that would happen,
i know that code is dirty ptr removing while fading.. though there is no error output. and the ptr removed the first panel. "add_contact_start2()" is an isolated function.
but dont understand how it affects the second creation, that has nothing to do with the ptr remove.
Last edited by MMike; 07/01/10 22:25.
|
|
|
Re: Fading panel problem.
[Re: Rei_Ayanami]
#331112
07/01/10 22:25
07/01/10 22:25
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
The pointer will change when the remove function runs...
edit: lukas was faster... so the pointer of panel 1 will be assigned to panel 2 , is that what you saying.?
|
|
|
Re: Fading panel problem.
[Re: MMike]
#331113
07/01/10 22:32
07/01/10 22:32
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
function load_wait(short a, short b, var time){ PANEL* ar=pan_create("bmap=c_map;",5); var timex=0; set(ar,SHOW); ar.pos_x=a;ar.pos_y=b; while(timex<time){wait(1); timex++;}
set(ar,TRANSLUCENT); //Allow alpha while(ar.alpha>0){ ar.alpha-=20*time_step; wait(1); }
ptr_remove(ar); //remove the local created panel pointer }
Last edited by Superku; 07/01/10 22:33.
"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
|
|
|
|