protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); if (gameOn == false) { spriteBatch.Draw(frontScreen, new Vector2(0, 0), Color.White); Vector2 textLocation = new Vector2(10, 10); spriteBatch.DrawString(hudFont, "XNA NODES OF YESOD REMAKE ", textLocation + new Vector2(295.0f, 020.0f), Color.Yellow); spriteBatch.DrawString(hudFont, "Start", textLocation + new Vector2(480.0f, 100.0f), Color.Yellow); spriteBatch.DrawString(hudFont, "Instructions", textLocation + new Vector2(480.0f, 120.0f), Color.Yellow); spriteBatch.DrawString(hudFont, "Define Keys ", textLocation + new Vector2(480.0f, 140.0f), Color.Yellow); spriteBatch.DrawString(hudFont, "Exit", textLocation + new Vector2(480.0f, 160.0f), Color.Yellow); spriteBatch.DrawString(hudFont, "Hit X to Start ", textLocation + new Vector2(480.0f, 240.0f), Color.Yellow); } else { if (!belowMoon) { if (rocket.RocketScreen == screenCounter) { rocket.Draw(spriteBatch); } for (int j = 0; j < 8; j++) { moonRocksRect = new Rectangle((int)(graphicsMan.UpperRockArray[screenCounter, j] * rockWidth), (int)0, rockWidth, rockHeight); spriteBatch.Draw(MoonRocks, new Rectangle((j * rockWidth), 170, rockWidth, rockHeight), moonRocksRect, Color.White); } moundRect = new Rectangle((int)(graphicsMan.MoundArray[screenCounter, 0] * lowerRockWidth), (int)300, lowerRockWidth, lowerRockHeight); if (graphicsMan.HoleArray0[screenCounter, 0] == 0) { man.colTileRect0 = new Rectangle((int)340, (int)415, 20, 18); holeRect0 = new Rectangle((int)(graphicsMan.HoleArray0[screenCounter, 0] * lowerRockWidth), (int)300, lowerRockWidth, lowerRockHeight); spriteBatch.Draw(MoonRocks, new Vector2(hole0X, holesY), holeRect0, Color.White); spriteBatch.Draw(collisionTile, new Vector2(hole0X + 20.0f, holesY + 15.0f), man.colTileRect0, Color.White); } if (graphicsMan.HoleArray0[screenCounter, 0] != 0) { man.colTileRect0 = new Rectangle((int)340, (int)0, 20, 18); } if (graphicsMan.HoleArray1[screenCounter, 0] == 0) { man.colTileRect1 = new Rectangle((int)540, (int)415, 20, 18); holeRect1 = new Rectangle((int)(graphicsMan.HoleArray1[screenCounter, 0] * lowerRockWidth), (int)300, lowerRockWidth, lowerRockHeight); spriteBatch.Draw(MoonRocks, new Vector2(hole1X, holesY), holeRect1, Color.White); spriteBatch.Draw(collisionTile, new Vector2(hole1X + 20.0f, holesY + 15.0f), man.colTileRect1, Color.White); } if (graphicsMan.HoleArray1[screenCounter, 0] != 0) { man.colTileRect1 = new Rectangle((int)340, (int)0, 20, 18); } spriteBatch.Draw(MoonRocks, new Vector2(100.0f, 300.0f), moundRect, Color.White); spriteBatch.Draw(MoonRocks, new Vector2(600.0f, 300.0f), moundRect, Color.White); for (int l = 0; l < 8; l++) { lowMoonRocksRect = new Rectangle((int)(graphicsMan.LowerRockArray[screenCounter, l] * lowerRockWidth), (int)170, lowerRockWidth, lowerRockHeight); spriteBatch.Draw(MoonRocks, new Rectangle((l * lowerRockWidth), 470, lowerRockWidth, lowerRockHeight), lowMoonRocksRect, Color.White); } earth.Draw(spriteBatch); } else if (belowMoon) { rects.Clear(); walls.Clear(); platform.Clear(); edibleWalls.Clear(); alchiems.Clear(); testList.Clear(); if (roof.Count > 0) { roof.Clear(); } int textureY = 0; int textureX = 0; for (int ii = 0; ii < 10; ii++) { for (int jj = 0; jj < 13; jj++) { // Iterate through the array & point to the start position of the texture to be grabbed by the wallRect platforms = (graphicsMan.ToTheUnderGround[(belowScreenCounter * 10) + ii, jj]); if (platforms < 19) { textureY = 0; textureX = (0 * unGroTileWidth); } // If the image is greater than 19 then point to the next line in the texture if (platforms >= 19 && platforms < 38) { textureY = (unGroTileHeight * 1); textureX = (19 * unGroTileWidth); } // If the image is greater than 38 then point to the next line in the texture if (platforms >= 38 && platforms < 57) { textureY = (unGroTileHeight * 2); textureX = (38 * unGroTileWidth); } // If the image is greater than 57 then point to the next line in the texture if (platforms >= 57 && platforms < 76) { textureY = (unGroTileHeight * 3); textureX = (57 * unGroTileWidth); } //Grab the rectangle texture from the underground graphics.png wallRect = new Rectangle((int)(platforms * unGroTileWidth) - textureX, (int)textureY, unGroTileWidth, unGroTileHeight); spriteBatch.Draw(unGroundLedges, new Rectangle((jj * unGroTileWidth), ii * 48, 62, 48), wallRect, Color.White); collisionRects = new Rectangle((jj * unGroTileWidth), ii * 48, 62, 48); // Store the tiles to collide with in a List of Rectangles // Check if floor tiles exist & only 1 screen high (i!) // Alchiems if (platforms == 19 || platforms == 20 || platforms == 21 || platforms == 22) { alchiems.Add(collisionRects); } // Mole edible wall textures if (platforms == 15 || platforms == 16 || platforms == 17 || platforms == 18) { edibleWalls.Add(collisionRects); } // Floor textures if (platforms == 5 || platforms == 6 || platforms == 7 || platforms == 8 || platforms == 24 || platforms == 25 || platforms == 26 || platforms == 43 || platforms == 44) { rects.Add(collisionRects); } // Platforms & Ledges if (platforms == 9 || platforms == 10 || platforms == 11 || platforms == 13 || platforms == 14 || platforms == 28 || platforms == 29 || platforms == 47 || platforms == 48) { platform.Add(collisionRects); //Copy the x,y co-ord from the platform into the test test.Location = collisionRects.Location; testList.Add(test); } // Wall textures if (platforms == 0 || platforms == 1 || platforms == 2 || platforms == 3) { walls.Add(collisionRects); } // Roof textures if (platforms >= 57 && platforms < 76) { roof.Add(collisionRects); } } } foreach (Enemy en in enemies) { if (en is Alf) { Alf alf = (Alf)en; alf.Draw(spriteBatch); } if (en is Bird) { Bird bird = (Bird)en; bird.Draw(spriteBatch); } if (en is BlueThingy) { BlueThingy bluething = (BlueThingy)en; bluething.Draw(spriteBatch); } if (en is Caterpillar) { Caterpillar caterpillar = (Caterpillar)en; caterpillar.Draw(spriteBatch); } if (en is ChasingEnemy) { ChasingEnemy chasingEnemy = (ChasingEnemy)en; chasingEnemy.Draw(spriteBatch); } if (en is SpringBear) { SpringBear springbear = (SpringBear)en; springbear.Draw(spriteBatch); } if (en is Fire) { Fire fire = (Fire)en; fire.Draw(spriteBatch); } if (en is Fish) { Fish fish = (Fish)en; fish.Draw(spriteBatch); } if (en is GreenMeanie) { GreenMeanie greenie = (GreenMeanie)en; greenie.Draw(spriteBatch); } if (en is Plant) { Plant plant = (Plant)en; plant.Draw(spriteBatch); } if (en is RedSpaceman) { RedSpaceman redspace = (RedSpaceman)en; redspace.Draw(spriteBatch); } if (en is WhirlWind) { WhirlWind whirlWind = (WhirlWind)en; whirlWind.Draw(spriteBatch); } if (en is WoodLouse) { WoodLouse woodLouse = (WoodLouse)en; woodLouse.Draw(spriteBatch); } } } if (moleManAlive) { mole.Draw(spriteBatch); } if (!man.summerSaultJump) { man.Draw(spriteBatch, gameSpritesRect); } else { man.Draw(spriteBatch, gameSpritesRect); } spriteBatch.Draw(panel, new Vector2(30, 550), Color.White); spriteBatch.Draw(gameSprites, new Vector2(390.0f, 535.0f), heartBeatRect, Color.White); spriteBatch.DrawString(hudFont, "" + alchiem, new Vector2(250.0f, 555.0f), Color.White); spriteBatch.DrawString(hudFont, "" + man.Lives, new Vector2(395.0f, 555.0f), Color.White); string fps = string.Format("{0}", seconds); if (seconds < 10 && minutes == 0) { spriteBatch.DrawString(hudFont, "00:0" + seconds, new Vector2(635.0f, 555.0f), Color.White); } else if (seconds >= 10 && minutes == 0) { spriteBatch.DrawString(hudFont, "00:" + seconds, new Vector2(635.0f, 555.0f), Color.White); } if (seconds < 10 && minutes > 0) { spriteBatch.DrawString(hudFont, "0" + minutes + ":0" + seconds, new Vector2(635.0f, 555.0f), Color.White); } else if (seconds >= 10 && minutes > 0) { spriteBatch.DrawString(hudFont, "0" + minutes + ":" + seconds, new Vector2(635.0f, 555.0f), Color.White); } } spriteBatch.End(); base.Draw(gameTime); }