
All the areas I made changes to
By:
KevinYoung on
May 5th, 2012 | syntax:
None | size: 1.19 KB | hits: 46 | expires: Never
public boolean jump(int maxHeight) {
p.offsetYPos(-3);
if(Player.getyPos() <= maxHeight){
heightReached = true;
return heightReached;
}
return false;
}
public boolean fall(){
MainMenu.goUp = false;
if (Player.getyPos() >= maxHeight){
p.offsetYPos(3);
}
return true;
}
private boolean initDelay(double timer, double speed){
if(counter == timer){
counter = 0;
return true;
}
else{
counter += speed;
return false;
}
}
public void update(){
if(MainMenu.goUp){
if(initDelay(90, 1))
jump(MainMenu.maxHeight);
shouldContinue = jump(MainMenu.maxHeight);
}
if (shouldContinue){
MainMenu.goUp = false;
shouldContinue = fall();
}
if (shouldContinue){
MainMenu.goDown = true;
shouldContinue = true;
}
else if(counter > timer)
counter = timer;
else
counter++;
if(MainMenu.goDown){
if(initDelay(90, 1)){
fall();
counter = 0;
MainMenu.goDown = false;
}
else if(counter > timer)
counter = timer;
else
counter++;
}