This site requires JavaScript, please enable it in your browser!
Greenfoot back
joshuadswa
joshuadswa wrote ...

2017/2/16

Im New Here

joshuadswa joshuadswa

2017/2/16

#
Hello, My name is Joshua and im new here :D Nice to meet you all ^^ also can anyone give me the example using delay? thx :)
joshuadswa joshuadswa

2017/2/16

#
public void shootProjectile() { getWorld().addObject(new Projectile1(), getX(), getY()); Greenfoot.delay(5); } if i put the delay will delay the whole scenario o.o, i just want it to delay some actor xD
danpost danpost

2017/2/16

#
joshuadswa wrote...
public void shootProjectile() { getWorld().addObject(new Projectile1(), getX(), getY()); Greenfoot.delay(5); } if i put the delay will delay the whole scenario o.o, i just want it to delay some actor xD
private int shotDelay;

public void shootProjectile()
{
    if (shotDelay > 0 && --shotDelay != 0) return;
    getWorld().addObject(new Projectile(), getX(), getY());
    shotDelay = 30;
}
joshuadswa joshuadswa

2017/2/16

#
Thx a lot :D really help me ^^
You need to login to post a reply.