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

2019/10/22

How could I set my ship to stop shooting for a few seconds after being hit by an object?

Someguyoutside Someguyoutside

2019/10/22

#
if processShot() is my method for shooting, how would I be able to delay that or pause it for a few seconds?
danpost danpost

2019/10/22

#
Someguyoutside wrote...
if processShot() is my method for shooting, how would I be able to delay that or pause it for a few seconds?
Add shot delay field:
// outside method
private int shotDelay;
Then:
// in act method
if (shotDelay == 0) processShot(); else shotDelay--;
Set value of field to something like 180 when hit by object.
You need to login to post a reply.