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

danpost's Comments

Back to danpost's profile

@ErnieBoi, thanks -- fixed (cannot pass 1).
@momochow, unfortunately that was on a computer on which the mother (f) board fried. No source is available for me to update. Sorry :(
danpostdanpost

2018/8/28

Not really useful unless you use it properly. Notice how your slower moving flakes only go horizontally and vertically and slightly faster ones might go diagonally (along multiples of 45 degrees). This is caused by hardware constraints (pixel locations on the screen). Better use of the class would allow any angle at any speed.
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.