(Disclaimer: I worked on Java games running on many mobile devices)
, if. , CollisionDetectionException, , .
Java OO: , , - Java, . Java- , Spring. , , , , , ( : " " OO, , OOA/OOD OOP ).
: ArrayIndexOutOfBoundException . , , HUGE no-no.
, isBorder... , , . , , . , ""? , .
, , , static - - OO. , . , isCollidingWith (...): , "", , , , isCollidingWith (...).
: isCollidingWith (...) resolveCollisionWith (...).
public class Wall implements MySuperAbstraction {
int wallHitPoints = 42;
boolean isWallStillUp = true;
void resolveCollisionWith( SomeObject o ) {
if ( o.isStrongEnoughToHarmWall ) {
wallHitPoints--;
isWallStillUp = wallHitPoints > 0;
}
}
}
, , SomeObject, , , .., : OO , . , , .
OO, , , , Java static, instanceof . , - OO:)
]