Java Game | 128x160 Snake Xenzia
g.setColor(0x00FF00); // green body for(int i=0; i<length; i++) g.fillRect(offsetX + x[i]*CELL_SIZE, offsetY + y[i]*CELL_SIZE, CELL_SIZE-1, CELL_SIZE-1);
private void updateGame()
RecordStore rs = RecordStore.openRecordStore("HighScore", true); byte[] data = (score + "").getBytes(); rs.addRecord(data, 0, data.length); Play Tone Manager.playTone(ToneControl.C4, 100, 100); Vibrate Display.getDisplay(midlet).vibrate(200); 128x160 snake xenzia java game
private void initGame() length = 3; snakeX[0] = W/2; snakeY[0] = H/2; snakeX[1] = W/2-1; snakeY[1] = H/2; snakeX[2] = W/2-2; snakeY[2] = H/2; direction = 1; // right nextDir = 1; score = 0; spawnFood(); gameState = 0; // green body for(int i=0
public void pauseApp() {} public void destroyApp(boolean unconditional) canvas.stop(); i++) g.fillRect(offsetX + x[i]*CELL_SIZE
