import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class player here. * * @author (your name) * @version (a version number or a date) */ public class player2 extends Actor { /** * Act - do whatever the player wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { bewegung(); gravitation(); springen(); } public void bewegung(){ if(Greenfoot.isKeyDown("right")){ setRotation(0); move(3); } if(Greenfoot.isKeyDown("left")){ setRotation(0); move(-3); } } public void springen(){ if(Greenfoot.isKeyDown("-") && this.getY() > 370 ){ for(int i = 12; i > -12; i--){ setRotation(270); move(i); setRotation(0); Greenfoot.delay(1); bewegung(); } } } public void gravitation(){ if(this.getY() < 370){ setRotation(90); move(4); setRotation(0); } } }