hello
i whanted to make an enemy target a certain coordinates in the level
then move or jump to those coordinates
and then spawn another entity once is there...
spawning the entity is getting complicated because of the panel movement...!!!
i got this script from contra
i still havent use it
does anyone know if it will work on the level coordinates !!!
this is might explain better what iam trying to do....
sorry about the darwing confusion i used the mouse to make this
i whanted to make an enemy target a certain coordinates in the level
then move or jump to those coordinates
and then spawn another entity once is there...
spawning the entity is getting complicated because of the panel movement...!!!
i got this script from contra
void target0(float Velx, float Vely, float Tx, float Ty, float dx, float dy, void Vel, int Flip)
{// Basic Targetting certain coordinate before dashing
// Velx = Desired x Velocity
// Vely = Desired y Velocity
// Tx = target x coordinate
// Ty = target y coordinate
// dx = x added distance
// dy = y added distance
// Vel = Desired output
void self = getlocalvar("self");
int dir = getentityproperty(self, "direction");
float x = getentityproperty(self, "x");
float y = getentityproperty(self, "a");
float Vx;
float Vy;
if(Flip == 1){
if(Tx < x){
changeentityproperty(self, "direction", 0);
} else {
changeentityproperty(self, "direction", 1);
}
}
x = x+dx;
y = y+dy;
float Disx = Tx - x;
float Disy = Ty - y;
//Set both distance as positive value
if(Disx < 0){
Disx = -Disx;
}
if(Disy < 0){
Disy = -Disy;
}
// Calculate velocity for targetting
if(Disy < Disx)
{
if(Tx < x){
Vx = -Velx;
} else { Vx = Velx; }
Vy = Velx*(Ty-y)/Disx;
} else {
if(Ty < y){
Vy = -Vely;
} else { Vy = Vely; }
Vx = Vely*(Tx-x)/Disy;
}
if(Vel == "x"){
return Vx;
}
if(Vel == "y"){
return Vy;
}
}
i still havent use it
does anyone know if it will work on the level coordinates !!!
this is might explain better what iam trying to do....
sorry about the darwing confusion i used the mouse to make this