import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.List;
/**
* Write a description of class Human here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Human extends Mover
{
private static int jumpStrength = 16;
private double speed;
private int speed2 = 3;
int counter;
public void act()
{
move();
checkFall();
jumpup();
obsicles();
}
public void move()
{
if(Greenfoot.isKeyDown("a"))
{
move(-speed2);
}
if(Greenfoot.isKeyDown("d"))
{
move(speed2);
}
if (Greenfoot.isKeyDown("space") )
{
if (floor())
{
jump();
}
}
}
public void obsicles()
{
while(getOneObjectAtOffset(0, getImage().getHeight()/2+1, Brick.class)!=null)
{
setLocation(getX(),getY()-1);
}
}
private void jump()
{
setVSpeed(-jumpStrength);
fall();
}
public void jump2()
{
jumpStrength = 32;
fall();
}
private void checkFall()
{
if (floor()) {
setVSpeed(0);
}
else {
fall();
}
}
public void jumpup()
{
Actor c = getOneIntersectingObject(Powerup.class);
if( c != null)
{
getWorld().removeObject(c);
jump2();
}
if( counter >= 30)
{
jumpStrength = 16;
}
}
}