Hi All,
I'm begining to setup the collisions for the game objects, so far I have this:
How do I go about adding other classes into the method like:
and
I've tried to use an || operator but couldnt see how to add it in correctly.
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 | private void checkRightWalls() { int spriteWidth = getImage().getWidth(); int xDistance = ( int )(spriteWidth / 2 ); Actor rightWall = getOneObjectAtOffset(xDistance, 0 , SteppingTile. class ); if (rightWall != null ) { int wallWidth = rightWall.getImage().getWidth(); int newX = rightWall.getX() - (wallWidth + getImage().getWidth()) / 2 ; setLocation(newX - shared.speed, getY()); } } |
1 | Actor rightWall = getOneObjectAtOffset(xDistance, 0 , Block. class ); |
1 | Actor rightWall = getOneObjectAtOffset(xDistance, 0 , Pipe. class ); |