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

2016/10/20

Trying to make Rockets fall out of the sky randomly

1
2
3
DuckGod DuckGod

2016/10/20

#
ok when i press space it says spawning rocket
danpost danpost

2016/10/20

#
DuckGod wrote...
ok when i press space it says spawning rocket
Then, it is definitely spawning rockets. The question now is what happens to them? Give me a second to decide what to try next. You can remove the 'System.out.println' line from the 'spawnRocket' method in the meantime.
DuckGod DuckGod

2016/10/20

#
ok
danpost danpost

2016/10/20

#
By the way, what code do you have in your 'shotManager' class. Please show.
danpost danpost

2016/10/20

#
Comment out line 25 in your Rocket class (as shown previously in this discussion thread) and see what happens.
DuckGod DuckGod

2016/10/20

#
oh my gosh it was just the stop(); that was makeing the rockets dissapear. now it spawns rockets. Thank you danpost
danpost danpost

2016/10/20

#
DuckGod wrote...
oh my gosh it was just the stop(); that was makeing the rockets dissapear. now it spawns rockets. Thank you danpost
I think that if you uncomment the 'stop' call and move the speed slider down a bit, you will see the animated explosion in slow motion. I believe it was just too quick for you to see it at the normal speed.
DuckGod DuckGod

2016/10/21

#
I just figured out that i had it backwards i was suppose to have it like this
public void stop()
    {
        if(!getIntersectingObjects(Grounds.class).isEmpty())
        {
            shootingSpeed=0;
            animateExplodes();
            stopRemove();
        }
        else
        {
            shootingSpeed=8;
        }
    }
Thanks danpost.
danpost danpost

2016/10/21

#
DuckGod wrote...
I just figured out that i had it backwards i was suppose to have it like this < Code Omitted >
I mentioned my concern over that code previously in this discussion:
I am actually puzzled about the code starting from there. If a Ground object is found intersecting, it does not seem correct to give it 'shootingSpeed'; and to remove 'shootingSpeed' if no ground is detected.
You need to login to post a reply.
1
2
3