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

2020/3/5

How to properly use setImage?

1
2
3
danpost danpost

2020/3/7

#
footpickle wrote...
Earlier I asked if there was a way to make this: << Code Omitted >> go in reverse (so the image instead of going 1, 2, 3, 4, 5 etc, it goes 5, 4, 3, 2, 1.) Is there a way to do this, or have I wasted hours making my health bar?
Replace "health" with "(63-health)" -- or "(180-health)".
danpost danpost

2020/3/7

#
footpickle wrote...
I'm also trying to add some "cool" asteroids that when one hits the edge of the world, it creates a new one somewhere on the screen, but it duplicates over and over until the screen is just a bunch of rocks. I THINK the problem may be the fact that the code is in the act() method, which I've heard repeats itself.
Instead of adding new asteroids, try turning them around using "turnToward" so they aim back toward the center of the world, then add a small random turn, say between -15 to 15 degrees.
danpost danpost

2020/3/7

#
footpickle wrote...
I figured it out and fixed it :) I've now made it so when the boss hits the main actor (Plane2) it triggers an explosion, and then Plane2 disappears. That then screws up some of the bosses code that makes the boss follow the player. I made the plane NOT disappear and now there are so many explosions my game lags a lot. I'm stumped as to what to do. I guess it's either a laggy game or no game...
Go ahead and make the plane disappear. Put a condition on the "screwed up code" that the list getting the plane not be empty before getting the plane from the list.
footpickle footpickle

2020/3/7

#
danpost wrote...
Replace "health" with "(63-health)" -- or "(180-health)".
Where would I put this in this situation?
1
2
3
4
protected void updateImage()
        {
            setImage(new GreenfootImage("Health"+health+".png"));
        }
footpickle footpickle

2020/3/8

#
Also, how would I get a value from one actor to another? I'm trying to make a counter that saves the data over multiple worlds, but I couldn't figure out how so I made a new counter and tried to get the first counter's data, but it didn't work. How do I get the value from Counter to Counter2?
You need to login to post a reply.
1
2
3