@Bloodbane , i've tried your script but the entity is apawned and go left out of the screen and dont flip and come back.
Seems like it just perform the spawn animation.
Take a look at my entity flag.
name car
type none
health 9999
Speed 8
anim idle
@script
void self = getlocalvar("self"); //Get calling entity.
int Dir = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int Vx = getentityproperty(self, "xdir");
int XPos = openborvariant("xpos"); //Get screen edge's position
int Screen = openborvariant("hResolution"); // Get screen width
if(x >= XPos + Screen + 160 && Dir==1){
changeentityproperty(self, "position", NULL(), 240);
changeentityproperty(self, "velocity", -Vx);
changeentityproperty(self, "direction", 0);
} else if(x <= XPos - 160 && Dir==0){
changeentityproperty(self, "position", NULL(), 180);
changeentityproperty(self, "velocity", -Vx);
changeentityproperty(self, "direction", 1);
}
@end_script
loop 1
offset 40 45
delay 12
frame data/npcs/car/c.png
frame data/npcs/car/c2.png
frame data/npcs/car/c3.png
frame data/npcs/car/c4.png
frame data/npcs/car/c5.png
frame data/npcs/car/c6.png
anim spawn
@script
if(frame==1){
void self = getlocalvar("self"); //Get calling entity.
int Dir = getentityproperty(self, "direction");
if(Dir==1){
changeentityproperty(self, "velocity", 1);
} else {
changeentityproperty(self, "velocity", -1);
}
}
@end_script
offset 40 45
delay 12
frame data/npcs/car/c.png
frame data/npcs/car/c2.png
frame data/npcs/car/c3.png
frame data/npcs/car/c4.png
frame data/npcs/car/c5.png
frame data/npcs/car/c6.png