delay in events
Posted: Sat Jan 07, 2017 1:35 pm
Hello, I have a problem in creating my map. I want to make gun burst for let's say, 20 bullets and wait some time. Here is script:
problem is that the gun is firing continous. turret and turrer2 are timers.
Code: Select all
public void Timer(TriggerArgs args)
{
}
public void turret(TriggerArgs args){
for(int i = 0; i < 20;i++)
{
IObject obj = Game.GetSingleObjectByCustomId("start");
IObject objDir = Game.GetSingleObjectByCustomId("end");
Vector2 pos = obj.GetWorldPosition();
Vector2 dir = objDir.GetWorldPosition();
Game.SpawnProjectile(ProjectileItem.M60, pos, dir - pos);
}
}
public void turret2(TriggerArgs args){
IObject obj = Game.GetSingleObjectByCustomId("start");
IObject objDir = Game.GetSingleObjectByCustomId("end");
Vector2 pos = obj.GetWorldPosition();
Vector2 dir = objDir.GetWorldPosition();
Game.SpawnProjectile(ProjectileItem.BAZOOKA, pos, dir - pos);
}