if (input.isKeyDown(Input.KEY_W)){ if (!Block.getMask().contains(mask.getCenterX(),mask.getY()-1)) { y-=.2; }}
All I'm trying to do is check in a single direction whether or not there's a block in my way. Block is the class used to create my block objects. I gave it the method getMask() which simply returns the rectangle used for collisions. contains is a method bundled with the Slick library. It checks whether or not a point lies within a given shape (in this case, the Block's mask). The rest of it is pretty self explanatory. I'm pretty sure my problem is in using Block as my comparison. I was hoping this would reference all instances of the Block class, but apparently this is not true. Can anyone help me out?