move 1 unit of time 's worth of distance . i.e. increment xpos by xvel and ypos by yvel . if we move off an edge of the screen move us back in the opposite edge . concode_field_sep Game game concode_elem_sep double xVel concode_elem_sep double yPos concode_elem_sep boolean alive concode_elem_sep double oldXPos concode_elem_sep double xPos concode_elem_sep double oldYPos concode_elem_sep double yVel concode_field_sep void die concode_elem_sep void handleCollision concode_elem_sep boolean isAlive concode_elem_sep void setIsAlive concode_elem_sep int getSize concode_elem_sep void setYVel concode_elem_sep double getXPos concode_elem_sep void setXVel concode_elem_sep double getYPos concode_elem_sep Game getGame concode_elem_sep void accelerate concode_elem_sep double getOldXPos concode_elem_sep double getOldYPos concode_elem_sep double getXVel concode_elem_sep double getYVel
void function ( ) { oldXPos = xPos ; oldYPos = yPos ; xPos = ( xPos + xVel ) % getGame ( ) . getWidth ( ) ; if ( xPos < 0 ) xPos += getGame ( ) . getWidth ( ) ; yPos = ( yPos + yVel ) % getGame ( ) . getHeight ( ) ; if ( yPos < 0 ) yPos += getGame ( ) . getHeight ( ) ; }