SHARE
TWEET

Untitled

a guest Jan 12th, 2017 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ObjectSpawner {
  2. /**
  3. * @Author Martijn
  4. *
  5. * Deze class plaats alle obstacles in de levels
  6. */
  7.  
  8.   // Maakt een ArrayList aan voor alle wall objecten in level 1
  9.   // Wall objecten zijn de opbjecten op de grond
  10.   public ArrayList<Wall> spawnLevel1Wall(ArrayList<Wall> walls) {
  11.  
  12.  
  13.     // spawnt wall instances
  14.     walls.add(new Wall(width + 100,height - 50,"koffer klein.png"));
  15.     walls.add(new Wall(width + 550,height - 50,"koffer klein.png"));
  16.     walls.add(new Wall(width + 1050,height - 50,60,113,"koffer groot.png"));
  17.     walls.add(new Wall(width + 1550,height - 50,"koffer klein.png"));
  18.     walls.add(new Wall(width + 1650,height - 50,"koffer klein.png"));
  19.     walls.add(new Wall(width + 2150,height - 50,60,113,"koffer groot.png"));
  20.     walls.add(new Wall(width + 2600,height - 50,60,113,"koffer groot.png"));
  21.     walls.add(new Wall(width + 3000,height - 50,"koffer klein.png"));
  22.     walls.add(new Wall(width + 3100,height - 50,60,113,"koffer groot.png"));
  23.     walls.add(new Wall(width + 3450,height - 50,60,113,"koffer groot.png"));
  24.     walls.add(new Wall(width + 4300,height - 50,60,113,"koffer groot.png"));
  25.     walls.add(new Wall(width + 4850,height - 50,"koffer klein.png"));
  26.     walls.add(new Wall(width + 6100,height - 50,60,113,"koffer groot.png"));
  27.     walls.add(new Wall(width + 6550,height - 50,60,113,"koffer groot.png"));
  28.     walls.add(new Wall(width + 7500,height - 50,60,113,"koffer groot.png"));
  29.     walls.add(new Wall(width + 7600,height - 50,"koffer klein.png"));
  30.     walls.add(new Wall(width + 9800,height - 50,"koffer klein.png"));
  31.     walls.add(new Wall(width + 9900,height - 50,60,113,"koffer groot.png"));
  32.     walls.add(new Wall(width + 9950,height - 50,"koffer klein.png"));
  33.  
  34.     // Bepaalt de horizontale snelheid van de wall objecten
  35.     for(Wall wall : walls) {
  36.       wall.setInitVX(8);
  37.     }
  38.  
  39.   return walls;
  40. }
  41.  
  42. public ArrayList<Wall> spawnLevel1Skateboard(ArrayList<Wall> skateboards) {
  43.  
  44.   skateboards.add(new Wall(width + 6700,height - 50,113,60,"skateboard.png",12));
  45.   skateboards.add(new Wall(width + 8300,height - 50,113,60,"skateboard.png",12));
  46.   skateboards.add(new Wall(width + 8800,height - 50,113,60,"skateboard.png",12));
  47.   skateboards.add(new Wall(width + 10800,height - 50,113,60,"skateboard.png",12));
  48.   skateboards.add(new Wall(width + 11000,height - 50,113,60,"skateboard.png",12));
  49.   skateboards.add(new Wall(width + 12500,height - 50,113,60,"skateboard.png",12));
  50.   skateboards.add(new Wall(width + 13500,height - 50,113,60,"skateboard.png",12));
  51.   skateboards.add(new Wall(width + 13650,height - 50,113,60,"skateboard.png",12));
  52.  
  53.   for(Wall skateboard : skateboards) {
  54.     skateboard.setInitVX(12);
  55.   }
  56.   return skateboards;
  57. }
  58.  
  59.   // Maakt een ArrayList aan voor alle coin objecten in level 1
  60.   public ArrayList<Coin> spawnLevel1Coin(ArrayList<Coin> coins) {
  61.  
  62.     //spawn coin instances
  63.     coins.add(new Coin(width + 200,height - 150,80,80 ));
  64.     coins.add(new Coin(width + 700,height - 250,80,80 ));
  65.     coins.add(new Coin(width + 1100,height - 250,80,80 ));
  66.     coins.add(new Coin(width + 2200,height - 250,80,80 ));
  67.     coins.add(new Coin(width + 2700,height - 150,80,80 ));
  68.     coins.add(new Coin(width + 4200,height - 150,80,80 ));
  69.     coins.add(new Coin(width + 6200,height - 150,80,80 ));
  70.  
  71.     // Bepaalt de horizontale snelheid van het coin object
  72.     for(Coin coin : coins) {
  73.         coin.setVX(8);
  74.     }
  75.  
  76.     return coins;
  77.   }
  78.  
  79.   // Plaatst een end object in level 1
  80.   public End spawnLevel1End(End end) {
  81.  
  82.     //spawnt end instance
  83.     end = new End(width +10200,height,40,50);
  84.  
  85.     // Bepaalt de horizontale snelheid van het end object
  86.     end.setVX(8);
  87.  
  88.     return end;
  89.   }
  90.  
  91.   public ArrayList<Wall> spawnBonusLevelWall(ArrayList<Wall> walls) {
  92.  
  93.       // spawnt wall instances
  94.       walls.add(new Wall(Constants.LEFTPOS1,-100,50,75));
  95.       walls.add(new Wall(Constants.LEFTPOS2,-250));
  96.       walls.add(new Wall(Constants.RIGHTPOS1,-500,40,75));
  97.       walls.add(new Wall(Constants.MIDDLE,-50));
  98.  
  99.       // Bepaalt de horizontale snelheid van de wall objecten
  100.       for(Wall wall : walls) {
  101.         wall.setVY(4);
  102.       }
  103.  
  104.     return walls;
  105.   }
  106.  
  107. }
RAW Paste Data
Top