Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. GameView() {
  2.     AnimationTimer animationTimer = new AnimationTimer() {
  3.  
  4.         @Override
  5.         public void handle(final long time) {
  6.             updateGame()
  7.         }
  8.     };
  9.  
  10.     private void updateGame() {
  11.         entitiesView.stream().forEach(entityView::update);
  12.     }
  13. }
  14.  
  15. EntityView() {
  16.    
  17.     EntityModel model;
  18.     ImageView myImage;
  19.  
  20.     public EntityView(EntityModel model) {
  21.         this.model = model;
  22.         // creazione immagine e inserimento nella scena
  23.         // etc..
  24.     }
  25.  
  26.     public void update() {
  27.         myImage.setX(model.getPosition().x);
  28.         myImage.setY(model.getPosition().y);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement