Obstacle count entity

dantedevil

Well-known member
I try to create an obstacle count for the bonus stages, but not work.
Then when you destroy all the obstacles, the entity change the animation and spawn the PERFECT text. And finally end the stage.

Here my try:
Code:
#BONUS - OBSTACLE COUNT
anim follow1
@script
    void self = getlocalvar("self");
    int Obstacle = openborvariant("count_obstacles");

    if(Obstacle == 0){
      changeentityproperty(self, "velocity", 0, 0, 0); 
      performattack(self, openborconstant("ANI_FOLLOW2"));
    }
@end_script
	loop	1
	delay	1
        offset 1 1
        frame data/chars/misc/empty.png
        frame data/chars/misc/empty.png


#BONUS - ALL OBSTACLES DESTROY
anim follow2
	loop	0
	delay	1
        offset 1 1
        @cmd    spawnAniEdge "textlist" 0 18 0 "ANI_FOLLOW3" 0
        frame data/chars/misc/empty.png
	delay	20
        frame data/chars/misc/empty.png
	delay	1
	@cmd	finishlevel 
        frame data/chars/misc/empty.png

I can't use the script to change the type of the obstacles to enemies, to avoid all the script check grab of the hero's.
I don't want make a can't grab exception for all obstacles in the bonus stages.
I think the obstale count entity is the best solution.
 
Solution
@O Ilusionista fixed xD thanks for the assist brother
ill post the whole animation here in case anyone else might need this.. remember to put an endlevel behind the door and also i used a platform to block its path.
that delay -1 is key tho.. if you dont put it there it will revert to idle animation that has the platform blocking the way.

fixed code same as below
Code:
name    door
health    1
type    obstacle
setlayer -9


anim idle
    loop 1
    delay 500
@script
    void self = getlocalvar("self");
    int C = openborvariant("count_enemies"); // Get count of enemies.
    int follow_played = getlocalvar("follow_played"); // Flag to track if follow animation was played.

    // Initialize follow_played flag if not set...
I've mentioned this on my example, take a look :)
Btw, you don't need that localvar, since you have an infinite loop.
you did lol.. i did try on that one but i couldnt figure it out sadly... least we got this working for what i need it to do :)
thank you.
ill check into the variable.

EDIT: you mean the flags for follow_played? cus if so ive tried removing it to minized code like i always try to do lol.. no dice :(
 
Last edited:
Back
Top Bottom