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

danpost's Comments

Back to danpost's profile

danpostdanpost

2018/8/26

Much can be done to make this run a lot quicker. (1) convert PointVector class to a Flake class (which is already what it really is -- with the imaging and acting) (2) resetting a flake (to be a new flake) instead of removing and adding a new flake. The second part can be done in the act method of the actor class, thus eliminating the need to iterate through all flakes in the world act method.
@TonyStark112, it is, strangely enough, in the destroy method of the Enemy1 class.
Actually, you are setting deltaX to -fallspeed using "=-" where you should be adjusting its value with "+=". Also, when jumping, you need to set deltaX to jumpHeight using "= -".
I was mistaken. You do have a gravity value there -- but you are subtracting it where you should be adding it.
Also, you have yet to include any gravity values into the movement so that is slows down going up and then starts to come back down. Finally, its vertical decent will need to be stopped when at ground level or when landing on a platform.
You have fallspeed as a double, yet getY will always be an int. You will need to track the vertical position of the actor using a double field and use it instead of getY.
@Xolkiyr, you may want to start a discussion on that.
danpostdanpost

2018/6/18

@Samwcool, you could just download your uploaded scenario (you did include the source).
@JadeGoody, not all scenarios have to be games. This is just something that is visually pleasing. Also, the code was made available so that others may take from it what they can.