Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

JASdeep11

  • 2 years ago

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

  • This Question is Closed
  1. JASdeep11
    • 2 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

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.