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

2019/8/24

timer on spawning things

1
2
danpost danpost

2019/8/25

#
joejoe wrote...
ok i changed it and it works much better thank you about that correction but lets go back to my main question where to add a "super bullet" but i want to add interval (let's say like 8 secs) so it will not be spamable
Add a timer field and some code in act to run it. Then restrict spawning only to when the timer is zero. Set it to around 480 any time a superBullet is shot:
joejoe joejoe

2019/8/25

#
could you type down the code because i cant decipher what are you saying above because i still new to terms and stuff
danpost danpost

2019/8/25

#
danpost wrote...
private int sbTimer;

public void act()
{
    if (sbTimer > 0) sbTimer--;
    ...
Again, then add the extra condition that "sbTimer == 0" to shoot a superBullet and set sbTimer to 480 when shooting one.
Invalid closing tag prevented code (and rest of last post) from showing -- sorry.
joejoe joejoe

2019/8/26

#
danpost wrote...
danpost wrote...
private int sbTimer;

public void act()
{
    if (sbTimer > 0) sbTimer--;
    ...
Again, then add the extra condition that "sbTimer == 0" to shoot a superBullet and set sbTimer to 480 when shooting one.
Invalid closing tag prevented code (and rest of last post) from showing -- sorry.
what does invalid closing tag mean?
danpost danpost

2019/8/26

#
joejoe wrote...
what does invalid closing tag mean?
See for yourself. Hit "Quote" on my post, third from last, including this one. Look right at the end of the block of code.
You need to login to post a reply.
1
2