public override void Init() { const int FLOORLIMIT = 480; const int PLAYERHEIGHT = 120; const int PLAYERWIDTH = 100; const int GOBLINHEIGHT = 120; const int GOBLINWIDTH = 70; const int HEALTH = 100; const int PLAYERVELO = 4; const int ENEMYVELO = 3; handler = new GameObjectHandler(); Rectangle playerRect = new Rectangle(0, FLOORLIMIT - PLAYERHEIGHT, PLAYERWIDTH, PLAYERHEIGHT); Spiderman player = new Spiderman(playerRect, "player", handler, playerAnimations, game, PLAYERVELO, HEALTH, FLOORLIMIT + 1, playerIcon); player.SetProjectileTexture(projectileTexture); Rectangle goblinRect = new Rectangle(700, FLOORLIMIT - GOBLINHEIGHT, GOBLINWIDTH, GOBLINHEIGHT); GreenGoblin goblin = new GreenGoblin(goblinRect, "goblin", handler, greenGoblinAnimations, game, ENEMYVELO, HEALTH, FLOORLIMIT + 1, goblinIcon); handler.Add(player); handler.Add(goblin); backgroundContainer = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width * 2, game.GraphicsDevice.Viewport.Height); }
private void Start() { Goblin myGoblin = new Goblin(); myGoblin.Attack(); Goblin myRedGoblin = new RedGoblin(); myRedGoblin.Attack(); Goblin myGreenGoblin = new GreenGoblin(); myGreenGoblin.Attack(); }
/// <summary> /// Maakt de blok aan /// </summary> /// <param name="id">Afhankelijk van de id zullen we een bepaalde blok aanmaken</param> /// <param name="content">ContentManager object dat we gebruiken om textures te laden</param> /// <returns>De aangemaakt blok</returns> protected override GameObject CreateBlock(int id, ContentManager content) { GameObject b = null; if (id == 1) { b = new DirtBlock(content, "01"); } else if (id == 2) { b = new GrassTopBlock(content, "04"); } else if (id == 3) { b = new GrassRightBLock(content, "08"); } else if (id == 4) { b = new LeftTopCornerBlock(content, "03"); } else if (id == 5) { b = new RightTopCornerBlock(content, "02"); } else if (id == 6) { b = new AcidMudLeftAndBottomBlock(content, "19"); } else if (id == 7) { b = new AcidMudBottomBlock(content, "15"); } else if (id == 8) { b = new AcidMudRightAndBottomBlock(content, "22"); } else if (id == 9) { b = new GrassLeftBlock(content, "07"); } else if (id == 10) { b = new LeftBottomCornerBlock(content, "10"); } else if (id == 11) { b = new RightBottomCornerBlock(content, "09"); } else if (id == 12) { b = new PlatformBlock(content, "plate1"); } else if (id == 13) { b = new BoxFirstVariant(content, "box1"); } else if (id == 14) { b = new BoxSecondVariant(content, "box2"); } else if (id == 15) { b = new Scarecrow(content, "scarecrow"); } else if (id == 16) { b = new Pointer(content, "pointer"); } else if (id == 17) { b = new OrangeTree(content, "tree1"); } else if (id == 18) { b = new YellowTree(content, "tree2"); } else if (id == 19) { b = new MovingBlock(content, "plate1"); } else if (id == 20) { b = new MovingBlock(content, "plate1") { Invert = true } } ; else if (id == 21) { b = new StarCollectable(content, "star"); } else if (id == 22) { b = new BouncingAcidBall(content, "LavaFireballSprite"); } else if (id == 23) { b = new UpUnderBlock(content, "bovenonder"); } else if (id == 24) { b = new LeftOverRoofBlock(content, "linksoverkaping"); } else if (id == 25) { b = new RightOverRoofBlock(content, "rechtsoverkaping"); } else if (id == 26) { b = new UnderBlock(content, "13"); } else if (id == 27) { b = new FullBlock(content, "11"); } else if (id == 30) { b = new GreenGoblin(content, "GreenGoblinSprite"); } else if (id == 31) { b = new Giant(content, "GiantSprite"); } else if (id == 32) { b = new Orc(content, "BlackGoblin"); } else if (id == 33) { b = new BlueGoblin(content, "BlueMonster"); } else if (id == 40) { b = new InvisibleBlock(content, "legeBlok"); } else if (id == 50) { b = new ButtonNextLevel(content, "button"); } return(b); }