nice1, your version of intersection/setloc control is a tad easier to read than mine, thanks for the tip :D Here's my nightmare btw,
/**
* different locations gives different conditions, if the characters feet are inside the top half of a block(groundobject)
**/
public void checkFall()
{
int vy = getWorld().getHeight()-2;
if(getY() > vy)
{
death();
}
Actor ground1 = getOneObjectAtOffset(-xGround, yGround, Ground.class);
Actor ground2 = getOneObjectAtOffset(xGround, yGround, Ground.class);
if( ground1 != null)
{
vSpeed = 0;
if((getY()+getImage().getHeight()/2 > ground1.getY()-xGround) || (getY() > ground1.getY()+getImage().getHeight()/2 && onLadder()))
{
setLocation(getX(), ground1.getY()-ground1.getImage().getHeight()/2-getImage().getHeight()/2);
}
onGround = true;
}
else if( ground2 != null)
{
vSpeed = 0;
if(getY()+getImage().getHeight()/2 > ground2.getY()-xGround || (getY() > ground1.getY()+getImage().getHeight()/2 && onLadder()))
{
setLocation(getX(), ground2.getY()-ground2.getImage().getHeight()/2-getImage().getHeight()/2);
}
onGround = true;
}
use two intersecting conditions! also, you can (solution i came up with last week) that if megaman.getY()+megaman.getHeight/2 < than block.getY() && megaman.getY()+megaman.getHeight()/2 > block.getY()-10 then setLoc to getX(), getY()-block.getHeight()/2.. to lazy to write the whole sentence, basicly means if his feed or inside the upper part of the block, he's automaticly placed on the block , looks alot neater, check my platform game, the pitfall clone, the source code for that is in the barry class =)
2014/1/13
Platformer Tutorial
2013/12/29
Snake Avoider
2013/12/13
Platforming Beta
2013/12/13
Platforming Beta
2013/11/6
langtons