How to make my collision mechanism better....
Its working but sometimes the actor passes through the blocks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public void stone() { boolean upKeyDown; Actor Stone=getOneIntersectingObject(Stone. class ); ); if (Greenfoot.isKeyDown( "w" ) && Stone != null ) { speed= 0 ; } if (upKeyDown != Greenfoot.isKeyDown( "w" ) && Stone != null ) { move(- 15 ); } |