3 registered members (Konsti, AndrewAMD, 1 invisible),
1,376
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
move different entity with the same speed
#253737
02/26/09 14:23
02/26/09 14:23
|
Joined: Aug 2008
Posts: 49
Vyse220
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 49
|
I need to move 2 enemy with the same exactly speed. action move_ambsolid(){
my.ambient = 100;
my.z = player.z;
my.polygon = on;
var speed = 10;
my.passable = on;
move_mode = IGNORE_YOU + IGNORE_PASSABLE + IGNORE_PUSH + ACTIVATE_TRIGGER + GLIDE;
var enable_polycollision = 0;
while(my.x > -8000){
if(my.x < 1000){
my.passable = off;
}
ent_move(nullvector, nullvector);
my.x -= 30.5*time_step;
wait(1);
}
ent_remove(my);
} action part_enemy
{
my.ambient = -100;
while (player == null) {wait (1);}
my.z = player.z; // set the same height for the enemy ships and the player
var shuttle_speed;
my.skill10 = 2;
my.skill40 = 5; // I'm a ship
my.enable_impact = on;
my.event = destroy_them;
shuttle_speed.x = -1.99*time_step;
shuttle_speed.y = 0;
shuttle_speed.z = 0;
while ((my.x > -800) && (my.skill10 > 0))
{
move_mode = ignore_you + ignore_passable + glide;
ent_move (nullvector, shuttle_speed);
if ((vec_dist (my.x, player.x) < 800) && (total_frames % 90 == 1)) // random firing intervals
{
if (my.x > player.x) // still got the chance to hit the player?
{
snd_play (fire1_wav, 40, 0);
ent_create(sphere_mdl, vector(my.x+5,my.y,my.z) , move_bullet4);
}
}
wait (1);
}
ent_create(explosion_pcx, vector(my.x, my.y, my.z), animate_explosion);
ent_remove(me);
} These are the 2 entities, this seems to move with the same speed but one move with - 30*time_step and the other with -2*time_step The problem is that sometimes the speed of move_ambsolid change and i need it to be on the same speed of the enemy. Can somebody help me?
|
|
|
Re: move different entity with the same speed
[Re: Vyse220]
#253769
02/26/09 17:36
02/26/09 17:36
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
Senior Member
|
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
create variable which determine enemy speed, and then you need you set it to player speed
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|