Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 3 years ago

is the following code good as a starting point for a snake game im woking on

  • This Question is Closed
  1. JASdeep11
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    package Snake2; import javax.swing.JLabel; import javax.swing.JPanel; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; public class Snake extends JPanel implements KeyListener{ int [][] occupied=new int[50][50]; WALL=0,SNAKE=1,FOOD=2,COLLISION=3,NORTH=4,SOUTH=5,EAST=6,WEST=7;//the numbers that represent each number public static final int ROW_COUNT=50,COLUMN_COUNT=50;//dimension constants: occupied int level=1; int score=0; boolean gameOver=false; int [][] inintailPosition={{10,11},{10,12},{10,13},{10,14},{10,15}}; int [] xSnake= new int[2500];//{10,10,10,10,10,....} int[] ySnake= new int[2500];//{11,12,13,14,15,.....} int zSnake=5;//length of snake, max size is 50*50=2500 JLabel scoreBoard= new JLabel("Score: 0"); JLabel levelBoard= new JLabel("Level: 1"); JLabel spaceBoard= new JLabel("Press space for next level"); JLabel gameOverBoard=new JLabel("Game Over: Press Space"); random= new random(); }

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy