Course Solutions Uncategorized (Solved) : Help Object Orientated Java Code Movement Snake Need Implement Four Methods Left Right Mov Q34401491 . . . .

(Solved) : Help Object Orientated Java Code Movement Snake Need Implement Four Methods Left Right Mov Q34401491 . . . .

 

Help with object orientated Java code for movement of snake.

I need to implement four methods for up, down, left and rightfor movement of the snake, well the head part at least that makere-use of a method that calculates a lot of this already. Themethod in need to call in is :

private void moveTo(int newHeadX, int newHeadY) //provided
{
int oldHeadX = getHeadXPos();
int oldHeadY = getHeadYPos();
int oldBodyX = getBodyXPos();
int oldBodyY = getBodyYPos();
if (checkX(newHeadX) && checkY(newHeadY))
{
head.setXPos(newHeadX);
head.setYPos(newHeadY);
delay(100);
body.setXPos(oldHeadX);
body.setYPos(oldHeadY);
delay(100);
tail.setXPos(oldBodyX);
tail.setYPos(oldBodyY);
delay(100);
}
else
{
System.out.println(“Snake cannot cross boundary!”);
}

Based on what i know about this, it should be a fairly shortpiece of code to implement as it mainly uses the above method, butcan’t for

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post