slicky-grease
Member
I started programming an enemy in which he shoot missiles at the player. It is similar to the trucks from Metal Slug 3. Its at 2:15
I got everything programmed and it works as it should. However, it only shoots one missile at a time. I was wondering how I can go about programming this so it can shoot a barrage of them(like 10-15). Also, I want the enemy to stop firing the missiles after that certain amount and start the process all over again.
I got everything programmed and it works as it should. However, it only shoots one missile at a time. I was wondering how I can go about programming this so it can shoot a barrage of them(like 10-15). Also, I want the enemy to stop firing the missiles after that certain amount and start the process all over again.
GML:
switch(state)
{
case crabtank.idle:
hsp = 0;
timer += 1
if (timer >= max_missle_timer)
{
timer = 0
state = crabtank.anticipation;
}
break;
case crabtank.anticipation:
timer += 1
if timer >= max_missle_timer
{
timer = 0
instance_create_layer(x,y,"Enemy",obj_projectile)
vsp = -40
state = crabtank.missle_up
}
break;
case crabtank.missle_up:
{
state = crabtank.missle_wait;
}
break;
case crabtank.missle_wait:
timer += 1
num = irandom_range(1,100)
if (timer >= missle_wait_timer) && num < 5
{
timer = 0
xp = irandom_range(12,1325)
yp = 100
abc = instance_create_layer(xp,yp,"Enemy",obj_trance)
abc.speed = 8
abc.direction = 270
state = crabtank.missles
}
break;
case crabtank.missles:
timer += 1
if timer >= missle_wait_timer
{
timer = 0
state = crabtank.idle
}
break;
}