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

Comments for Jump and Run Demo w/Moving Platform

Return to Jump and Run Demo w/Moving Platform

A new version of this scenario was uploaded on Tue Apr 15 01:26:41 UTC 2014
Arthur114Arthur114

2014/4/15

thank you !
Arthur114Arthur114

2014/4/15

that will help me in the future, but for now i have solved my problem by adding huge platform on the ground.
Entity1037Entity1037

2014/4/15

I got my player stuck between the wall of the scenario and the moving platform...
A new version of this scenario was uploaded on Tue Apr 15 19:38:21 UTC 2014
danpostdanpost

2014/4/15

@Entity1037, fixed. I added collision detection to the What (platform) class.
docinkcdocinkc

2014/6/8

I tried writing this code to my game and i got an error message under the What class with the this(0); it was saying that "call to this must first statement in constructor",
danpostdanpost

2014/6/8

@docinkc, start a new discussion thread and using the 'code' tag below the input box to insert the problem code. Include a brief explanation of the problem.
AbidaKhanAbidaKhan

2014/9/15

Hi...i am a newbie....Can anyone pleas tell me how to download this demo?
fejfofejfo

2015/2/22

u can't unless he posts it with sorce
A new version of this scenario was uploaded on 2017-12-19 17:46:13 UTC
A new version of this scenario was uploaded on 2017-12-19 17:52:51 UTC
A new version of this scenario was uploaded on 2017-12-19 18:11:32 UTC
danpostdanpost

2017/12/19

Now, updated for HTML 5.
Super_HippoSuper_Hippo

2017/12/19

Is it just me or is the escape button not working with HTML 5? For example in this scenario, I can't leave the code view with escape. (x works). Not sure if this was always the case, but right now, it doesn't seem to work.
danpostdanpost

2017/12/20

@Hippo, escape works for me in HTML5.
Super_HippoSuper_Hippo

2017/12/20

Okay, maybe that's only a problem with Edge and Internet Explorer then.
Nice Game! I like how the code is as simple as possible for a very common game type. Thank you!
saw444saw444

2022/10/5

Why is he not jumping? import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Dante here. * * @author (your name) * @version (a version number or a date) */ public class Dante extends Actor { /** * Act - do whatever the Dante wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ static final int gravity = 2; static final int jumpForce = 30; int xSpeed = 4; int ySpeed = 0; public void act() { // Add your action code here. moveHorizontal(); } public void moveHorizontal() { int worldWidth = getWorld().getWidth(); int myWidth = getImage().getWidth(); int dx = 0; if(Greenfoot.isKeyDown("a")) dx--; if(Greenfoot.isKeyDown("d")) dx++; setLocation(getX()+dx*xSpeed, getY()); } private void moveVertically() { int worldHeight = getWorld().getHeight(); int myHeight = getImage().getHeight(); boolean onGround = false; ySpeed += gravity; setLocation(getX(), getY()+ySpeed); if(getY() > worldHeight-myHeight/2) { ySpeed = 0; onGround = true; } if(onGround && Greenfoot.isKeyDown("w")) { ySpeed =-jumpForce; } } }
saw444saw444

2022/10/5

ah i know why