src/Snake.java
/* Method to move snake on the x position. If direction is 0, the snake will move left and be facing left-wards.
	 * If the direction is 1, or anything but 0, it will face and move in the opposite direction. When the snake goes past
	 * any sides of the frame (left or right sides), the snake's direction will be randomized along with its y-position.
	 */
Method to move snake on the x position. If direction is 0, the snake will move left and be facing left-wards.
If the direction is 1, or anything but 0, it will face and move in the opposite direction. When the snake goes past
any sides of the frame (left or right sides), the snake's direction will be randomized along with its y-position.
Method to move snake on the x position . If direction is 0 the snake will move left and be facing left - wards . If the direction is 1 or anything but 0 it will face and move in the opposite direction . When the snake goes past any sides of the frame ( left or right sides ) the snake ' s direction will be randomized along with its y - position .
public void move(int pixels, int FRAME_WIDTH)
	{
		if (direction == 0)
		{
			this.xPos -= pixels;
		}
		else
		{
			this.xPos += pixels;
		}
		if (xPos <= 0 - width || xPos >= FRAME_WIDTH + width)
		{
			direction = rnd.nextInt(2);
			yPos = yPotential[rnd.nextInt(1) + 4];
			if (direction == 0)
			{
				xPos = FRAME_WIDTH;
			}
			else
			{
				xPos = 0 - width;
			}
			setImage(new ImageIcon("images\\snake" + direction + ".png"));
		}
	}
public void move ( int pixels , int FRAME_WIDTH ) { if ( direction == 0 ) { this . xPos -= pixels ; } else { this . xPos += pixels ; } if ( xPos <= 0 - width || xPos >= FRAME_WIDTH + width ) { direction = rnd . nextInt ( 2 ) ; yPos = yPotential [ rnd . nextInt ( 1 ) + 4 ] ; if ( direction == 0 ) { xPos = FRAME_WIDTH ; } else { xPos = 0 - width ; } setImage ( new ImageIcon ( "images\\snake" + direction + ".png" ) ) ; } }
Method to move snake on the x position.
Method to move snake on the x position .