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

Report as inappropriate.

Samwcool
Samwcool presents ...

2018/6/19

PlatformGame

What is wrong

1509 views / 10 in the last 7 days

Tags: with-source

open in greenfoot
Your browser is ignoring the <APPLET> tag.
SamwcoolSamwcool

2018/6/19

If someone sees this can you tell me what is wrong with it? it doesn't jump properly (ignore the random blocks).
danpostdanpost

2018/6/19

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.
danpostdanpost

2018/6/19

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.
danpostdanpost

2018/6/19

I was mistaken. You do have a gravity value there -- but you are subtracting it where you should be adding it.
danpostdanpost

2018/6/19

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 "= -".
SamwcoolSamwcool

2018/6/20

ah ok thanks i tried a new way to do it and i seem to have got it working
A new version of this scenario was uploaded on 2018-07-02 17:44:37 UTC
SamwcoolSamwcool

2018/7/2

new version

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.