cleaning indexed var at the beginning of stage

ABK

Well-known member
how to do this, im using
@script void main() {
clearlocalvar();
clearglobalvar();
} @end_script

Its in first spawned entity on stage but it doesnt clean my indexed var which stores position of player onscreen from previous level, so it spawns my player in wrong place cause it still remembers indexed var value from previous level.
 
Just use a levelscript.

levelscript data/levels/level1.c

BTW, only clear those you need. If you clear all,  something strange may happen.
 
well.. im creating more and more mess, the problem is that im using indexed var to store position in platform level but easier would be to detect where nearest platform is and respawn my character there, any way to detect platform ? or i have to detect entity by its "plat" name and respawn on nearest one ?
 
There is a function checkplatformbelow.
Code:
void e = checkplatformbelow(x, z, a);
This return the highest platform below altitude a, if any. So you can do a scan from left to right, say, 10 pixels per time. If it is a 2D stage it'll be easy.

 
how i can get coords with checkplatformbelow, i cant detect any platform or im doing something wrong, i check e "x" property and move character there but it doesnt work also what i do if i want to skip some values like skip x in velocity to leave it intact and adjust only z velocity?
 
Back
Top Bottom