Advertisement
Guest User

game z flappy robaka

a guest
Oct 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package o1
  2.  
  3. import constants._
  4.  
  5. class Game {
  6.  
  7. val bug = new Bug(new Pos(100,40))
  8. val obstacles = Vector[Obstacle](new Obstacle(70),new Obstacle(30),new Obstacle(20))
  9. def timePasses() {
  10. this.bug.fall()
  11. obstacles.foreach(_.approach)
  12. }
  13.  
  14. def activateBug() {
  15. this.bug.flap(15)
  16. }
  17.  
  18. def isLost: Boolean = {
  19. var kolizja = false
  20. // for( i <- 0 to 2)
  21. // {
  22. // if(obstacles(i).touches(bug)) kolizja = true
  23. // }
  24. kolizja = obstacles.exists(_.touches(bug)==true)
  25. !( bug.isInBounds == true && kolizja==false)
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement