Government & Politics

(2 files merged)

Description
(2 files merged)
Published
of 2
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  //Penambahan untuk menghasilkan high score   //Kunci Jawaban Tugas Akhir Modul 3   //deklarasi instance var   //some code  private static final int POIN_PER_APEL = 20;   private int score = 0;  private Glyphlayout layout = new Glyphlayout();   //dst  private void draw(){   batch .begin();   batch.draw(snakehead,snakeX,snakeY);   for (BodyPa rt bodyPart : bodyParts){  bodyPart.draw(batch);  }   if (apelavail){   batch.draw(apel, apelX, apelY);   }   if(state == STATE.GAME_OVER){   layout.setText(bitmapFont, GAME_OVER_TEXT);   bitmapFont .draw(batch ,GAME_OVER_TEXT,   viewport.getlllorldWidth ()-layout .width/2,   viewport.getWorldHeight()-layout .height/2);   }   drawScore();   batch.end ();   }    //some code   private void checkAppleCollision(){   if(apelavail && apelX == snakeX && apelY == snakeY){   BodyPart bodyPart = new BodyPart(snakebody);   bodyPart.updatePosisiBody(snakeX,snakeY);   bodyParts .insert(0,bodyPart);   addToScore();   apelavail = false;   }   }   //some code   private void doRestart ){   state = STATE .PLAYING;   bodyParts .clear);   snakeDirection = RIGHT;   directionSet = false;   timer = MOVE_TIME;   snakeX = 0;   snakeY = 0;   snakeXBeforeUpdate = 0;  snakeYBeforeUpdate 0;   apelavail = false;   }   private void addToScore(){   score += POIN_PER_APEL ;   }   private void drawScore(){  if (state == STATE.PLAYING){  String scorestring = Integer.toString (score);   layout.setText(bitmapFont, scorestring);   bitmapFont .draw(batch, scorestring,   viewport.getWorldWidth()/2 - layout .width/2,   viewport.getWorldHeight )/2 - layout.height/2);   }   }   //some code  
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x