Guest User

Untitled

a guest
Jan 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. // Scenario in which a win becomes true
  2. if(ballFollower.overlapping(hole, true))
  3. {
  4. win = true;
  5. ballFollower.remove();
  6. ball.remove();
  7. currentLevel += 1;
  8. previousLevel = currentLevel - 1;
  9. Action fadeIn = Actions.sequence(Actions.alpha(0), Actions.show(), Actions.fadeIn(2),
  10. Actions.forever(Actions.sequence(Actions.color(new Color(1, 0, 0, 1), 1),
  11. Actions.color(new Color(0, 0, 1, 1), 1))));
  12. winText.addAction(fadeIn);
  13. System.out.println(currentLevel);
  14. }
  15.  
  16. // If won, give an option to move onto the next level.
  17. if(win)
  18. {
  19. nextLevelLabel.setVisible(true);
  20. if(Gdx.input.isKeyPressed(Keys.ENTER))
  21. {
  22. // currentLevel increments by 1 once the level is won.
  23. game.setScreen(new ElevatorLevel(game, currentLevel));
  24. }
  25. }
  26.  
  27. private int previousLevel = 0;
  28. private int currentLevel = 1;
  29. public ElevatorLevel(Game g, int level)
  30. {
  31. super(g, level);
  32. currentLevel = level;
  33. }
Add Comment
Please, Sign In to add comment