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

vladdes

Högskolan Kristianstad, Osby

vladdes's collections

This user has no collections

Recent Comments | Show All

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; }
vladdes

2013/12/29

Well, that kind of saved me a lot of time, thanks buddy :)