SHARE
TWEET

game z flappy robaka

a guest Oct 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top