Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Audio;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework.GamerServices;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Media;
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- using ScrollingBackgroundSpace;
- using CameraSpace;
- using PlayerNamespace;
- using tut1;
- using TerrainNamespace;
- using enemy;
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- namespace tut1
- {
- public class obiect
- {
- public Vector2 position;
- public virtual void Update(GameTime theGameTime, Vector2 theSpeed, Vector2 theDirection)
- {
- if (theDirection.X > 0)
- {
- position += theDirection * theSpeed * (float)theGameTime.ElapsedGameTime.TotalSeconds;
- }
- else
- {
- if (position.X > 0)
- {
- position += theDirection * theSpeed * (float)theGameTime.ElapsedGameTime.TotalSeconds;
- }
- }
- }
- }
- public class animation
- {
- public animation(int total)
- {
- this.total_frames = total;
- this.current_frame = 0;
- this.previous_framechange = 0;
- }
- public int total_frames;
- public int current_frame;
- public float previous_framechange;
- }
- /// <summary>
- /// This is the main type for your game
- /// </summary>
- public class Game1 : Microsoft.Xna.Framework.Game
- {
- public int gameState = 0;//stan gry
- public int tocontinue = 0;//0 menu, 1- continuemenu
- public int current_stage = 1;
- int score = 0;
- const int introMenu = 0, gameRunning = 1,hiscores = 2, credits = 3, paused = 4,settings = 5, pausesettings = 6;//Stany gry
- //Tu można dodać menu
- MenuComponent menu;
- MenuComponent gameMenu;
- MenuComponent continueMenu;
- MenuComponent settingsMenu;//do deklaracji potem
- MenuComponent settingsPauseMenu;//do deklaracji potem
- MenuComponent hiscoreMenu;//do deklaracji potem
- MenuComponent creditsMenu;
- string[] onoff = { "on", "off" };
- //Dźwięki tu ładować
- SoundEffect menuSound;
- SoundEffect gameSound;
- SoundEffect pauseSound;
- SoundEffect shootSound;
- SoundEffectInstance menuInstance;//instancje można stopować i pauzować, do dzwięku trzeba zrobić instancje
- SoundEffectInstance gameInstance;
- SoundEffectInstance pauseInstance;
- SoundEffectInstance shootInstance;
- //lista strzałów
- public List<shoot> enemyBullets;
- List<shoot> bulletsList;
- public int soundEnabled;//1 no, 0 yes
- //grafika
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
- GraphicsDevice device;
- private ScrollingBackground MyBackground;
- public List<level> stages;
- //textury tu
- Texture2D Clouds;
- Texture2D foregroundTexture;
- Texture2D playerTexture;
- Texture2D heartTexture;
- Texture2D bulletTexture;
- Texture2D menuBackground;
- Texture2D gameMenuBackground;
- Texture2D settingsBackground;
- Texture2D creditsBackground;
- Texture2D hiscoresBackground;
- Texture2D enemy_texture;
- Texture2D tileset;
- Texture2D food_texture;
- Texture2D pusia;
- Texture2D spikes_texture;
- Texture2D heart_b;
- //pozycje
- public float RightScreenCoor;//kooordynaty prawego boku ekranu, poczatkowo rowne screenwidth, zmieniaja sie wraz z przesuwaniem ekranu
- public int screenWidth;
- public int screenHeight;
- //czcionki
- SpriteFont font;
- SpriteFont pauseFont;
- //gracz
- player mandy;
- //klawiatura
- KeyboardState keybStateOld = Keyboard.GetState();
- KeyboardState oldKeyboardState1 = Keyboard.GetState();
- KeyboardState oldKeyboardState2 = Keyboard.GetState();
- KeyboardState oldKeyboardState3 = Keyboard.GetState();
- //poziomy
- level stage1;
- level stage2;
- level stage3;
- public Game1()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
- }
- /// <summary>
- /// Allows the game to perform any initialization it needs to before starting to run.
- /// This is where it can query for any required services and load any non-graphic
- /// related content. Calling base.Initialize will enumerate through any components
- /// and initialize them as well.
- /// </summary>
- protected override void Initialize()//podstawowe żeczy w grze
- {
- // TODO: Add your initialization logic here
- graphics.PreferredBackBufferWidth = 800;
- graphics.PreferredBackBufferHeight = 600;
- graphics.IsFullScreen = false;
- graphics.ApplyChanges();
- Window.Title = "PROJECT 404";
- Camera.Initialize(screenWidth, screenHeight);
- base.Initialize();
- }
- /// <summary>
- /// LoadContent will be called once per game and is the place to load
- /// all of your content.
- /// </summary>
- protected override void LoadContent()//ładowanie:
- {
- // TODO: use this.Content to load your game content here
- // Napisy w menu
- string[] menuItems = { "New Game", "High Scores", "Settings" , "Credits" , "End Game" };
- string[] menuItems2 = { "Continue", "New Game", "High Scores", "Settings", "Credits", "End Game" };
- string[] gameMenuItems = { "Resume", "Main Menu", "Settings", "Exit" };
- string[] creditsItems = { "Back" };
- //sptitebatch
- spriteBatch = new SpriteBatch(GraphicsDevice);
- //menusy
- try
- {
- menu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), menuItems);
- Components.Add(menu);
- gameMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), gameMenuItems);
- Components.Add(gameMenu);
- continueMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), menuItems2);
- Components.Add(continueMenu);
- creditsMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), creditsItems);
- Components.Add(creditsMenu);
- string[] hiscores = { "Back" };
- hiscoreMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), hiscores);
- Components.Add(hiscoreMenu);
- string[] settingsItems = { "Sound " + onoff[soundEnabled], "return" };
- settingsMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), settingsItems);
- Components.Add(settingsMenu);
- string[] pauseSettingsItems = { "Sound " + onoff[soundEnabled], "return" };
- settingsPauseMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), pauseSettingsItems);
- Components.Add(settingsPauseMenu);
- //Dźwięki
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- gameSound = Content.Load<SoundEffect>("gameSound");
- menuSound = Content.Load<SoundEffect>("menuSound");
- pauseSound = Content.Load<SoundEffect>("pauseSound");
- shootSound = Content.Load<SoundEffect>("laser");
- gameInstance = gameSound.CreateInstance();
- gameInstance.IsLooped = true;
- menuInstance = menuSound.CreateInstance();
- menuInstance.IsLooped = true;
- pauseInstance = pauseSound.CreateInstance();
- pauseInstance.IsLooped = true;
- shootInstance = shootSound.CreateInstance();
- //strzały
- bulletsList = new List<shoot>();
- soundEnabled = 0;
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- spriteBatch = new SpriteBatch(GraphicsDevice);
- device = graphics.GraphicsDevice;
- screenWidth = device.PresentationParameters.BackBufferWidth;
- screenHeight = device.PresentationParameters.BackBufferHeight;
- RightScreenCoor = screenWidth;
- MyBackground = new ScrollingBackground();
- //tekstury
- Clouds = Content.Load<Texture2D>("ch62");
- MyBackground.Load(Clouds, screenWidth);
- foregroundTexture = Content.Load<Texture2D>("sand2");
- playerTexture = Content.Load<Texture2D>("msprite");
- heartTexture = Content.Load<Texture2D>("heart");
- creditsBackground = Content.Load<Texture2D>("credits");
- hiscoresBackground = Content.Load<Texture2D>("hiscoreBackground");
- settingsBackground = Content.Load<Texture2D>("settings");
- menuBackground = Content.Load<Texture2D>("menubackground");
- gameMenuBackground = Content.Load<Texture2D>("czarnyJakPieklo");
- font = Content.Load<SpriteFont>("myFont");
- tileset = Content.Load<Texture2D>("tileset_optical");
- pauseFont = Content.Load<SpriteFont>("pausefont");
- bulletTexture = Content.Load<Texture2D>("bullet");
- enemy_texture = Content.Load<Texture2D>("rainbow_optical");
- food_texture = Content.Load<Texture2D>("small_food");
- pusia = Content.Load<Texture2D>("ponys");
- spikes_texture = Content.Load<Texture2D>("spikes");
- heart_b = Content.Load<Texture2D>("Wild_At_Heart_by_candyshores");
- //gracz
- mandy = new player((int)screenWidth, (int)screenHeight);
- //level
- stages = new List<level>();
- stage1 = new level(1, screenWidth, screenHeight);
- stages.Add(stage1);
- enemyBullets = new List<shoot>();
- }
- catch (Exception e)
- {
- this.Exit();
- }
- }
- /// <summary>
- /// UnloadContent will be called once per game and is the place to unload
- /// all content.
- /// </summary>
- protected override void UnloadContent()
- {
- // TODO: Unload any non ContentManager content here
- }
- private void UpdateMenu(GameTime gameTime)//Update menu gry
- {
- KeyboardState keyboardState1 = Keyboard.GetState();
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- if (menuInstance.State != SoundState.Playing && soundEnabled == 0)//dzwiek
- {
- menuInstance.Play();
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- if (tocontinue == 0)//czy do menu weszlismy z pauzy- nie
- {
- if (menu.CheckKey(Keys.Down, keyboardState1, oldKeyboardState1))
- {
- menu.selectedIndex++;
- if (menu.selectedIndex == menu.menuItems.Length)
- menu.selectedIndex = 0;
- }
- if (menu.CheckKey(Keys.Up, keyboardState1, oldKeyboardState1))
- {
- menu.selectedIndex--;
- if (menu.selectedIndex < 0)
- menu.selectedIndex = menu.menuItems.Length - 1;
- }
- if (menu.CheckKey(Keys.Enter, keyboardState1, oldKeyboardState1))
- {
- if (menu.SelectedIndex == 0)
- {
- mandy = new player((int)screenWidth, (int)screenHeight);
- RightScreenCoor = screenWidth;
- Camera.Transform = Matrix.Identity;
- Camera.UpdateMatrix = false;
- Camera.Position = new Vector2(0, 0);
- gameState = 1;
- stages.Clear();
- stage1 = new level(1, screenWidth, screenHeight);
- stages.Add(stage1);
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- menuInstance.Stop();
- }
- else if (menu.SelectedIndex == 1)
- {
- gameState = 2;
- // menuInstance.Stop();
- }
- else if (menu.SelectedIndex == 2)
- {
- gameState = 5;
- //menuInstance.Stop();
- }
- else if (menu.SelectedIndex == 3)
- {
- gameState = 3;
- //menuInstance.Stop();
- }
- else if (menu.SelectedIndex == 4)
- {
- this.Exit();
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- }
- }
- else //jednak weszlismy z pauzy
- {
- if (continueMenu.CheckKey(Keys.Down, keyboardState1, oldKeyboardState1))
- {
- continueMenu.selectedIndex++;
- if (continueMenu.selectedIndex == continueMenu.menuItems.Length)
- continueMenu.selectedIndex = 0;
- }
- if (continueMenu.CheckKey(Keys.Up, keyboardState1, oldKeyboardState1))
- {
- continueMenu.selectedIndex--;
- if (continueMenu.selectedIndex < 0)
- continueMenu.selectedIndex = continueMenu.menuItems.Length - 1;
- }
- if (continueMenu.CheckKey(Keys.Enter, keyboardState1, oldKeyboardState1))
- {
- if (continueMenu.SelectedIndex == 0)
- {
- gameState = 1;
- menuInstance.Stop();
- }
- else if (continueMenu.SelectedIndex == 1)
- {
- mandy = new player((int)screenWidth, (int)screenHeight);
- RightScreenCoor = screenWidth;
- Camera.Transform = Matrix.Identity;
- Camera.UpdateMatrix = false;
- Camera.Position = new Vector2(0, 0);
- gameState = 1;
- score = 0;
- stages.Clear();
- stage1 = new level(1, screenWidth, screenHeight);
- stages.Add(stage1);
- bulletsList.Clear();
- menuInstance.Stop();
- }
- else if (continueMenu.SelectedIndex == 2)
- {
- gameState = 2;
- }
- else if (continueMenu.SelectedIndex == 3)
- {
- gameState = 5;
- }
- else if (continueMenu.SelectedIndex == 4)
- {
- gameState = 3;;
- }
- else if (continueMenu.SelectedIndex == 5)
- {
- this.Exit();
- }
- }
- }
- oldKeyboardState1 = keyboardState1;
- }
- private void UpdateGameMenu(GameTime gameTime)//menu pauzy
- {
- KeyboardState keyboardState2 = Keyboard.GetState();
- if (pauseInstance.State != SoundState.Playing && soundEnabled == 0)
- {
- pauseInstance.Play();
- }
- if (gameMenu.CheckKey(Keys.Down, keyboardState2, oldKeyboardState2))
- {
- gameMenu.selectedIndex++;
- if (gameMenu.selectedIndex == gameMenu.menuItems.Length)
- gameMenu.selectedIndex = 0;
- }
- if (gameMenu.CheckKey(Keys.Up, keyboardState2, oldKeyboardState2))
- {
- gameMenu.selectedIndex--;
- if (gameMenu.selectedIndex < 0)
- gameMenu.selectedIndex = gameMenu.menuItems.Length - 1;
- }
- if (gameMenu.CheckKey(Keys.Enter, keyboardState2, oldKeyboardState2))
- {
- if (gameMenu.SelectedIndex == 0)
- {
- gameState = 1;
- pauseInstance.Stop();
- }
- else if (gameMenu.SelectedIndex == 1)
- {
- continueMenu.SelectedIndex = 0;
- tocontinue = 1;
- gameState = 0;
- pauseInstance.Stop();
- }
- else if (gameMenu.SelectedIndex == 2)
- {
- gameState = 6;
- }
- else if (gameMenu.SelectedIndex == 3)
- {
- this.Exit();
- }
- }
- oldKeyboardState2 = keyboardState2;
- }
- private void UpdateHiScores(GameTime gameTime)//menu pauzy
- {
- KeyboardState keyboardState2 = Keyboard.GetState();
- if (hiscoreMenu.CheckKey(Keys.Down, keyboardState2, oldKeyboardState2))
- {
- hiscoreMenu.SelectedIndex++;
- if (hiscoreMenu.selectedIndex == hiscoreMenu.menuItems.Length)
- hiscoreMenu.selectedIndex = 0;
- }
- if (hiscoreMenu.CheckKey(Keys.Up, keyboardState2, oldKeyboardState2))
- {
- hiscoreMenu.selectedIndex--;
- if (hiscoreMenu.selectedIndex < 0)
- hiscoreMenu.selectedIndex = hiscoreMenu.menuItems.Length - 1;
- }
- if (hiscoreMenu.CheckKey(Keys.Enter, keyboardState2, oldKeyboardState2))
- {
- if (hiscoreMenu.SelectedIndex == 0)
- {
- gameState = 0;
- }
- }
- oldKeyboardState2 = keyboardState2;
- }
- private void UpdateCredits(GameTime gameTime)//menu pauzy
- {
- KeyboardState keyboardState2 = Keyboard.GetState();
- if (creditsMenu.CheckKey(Keys.Down, keyboardState2, oldKeyboardState2))
- {
- creditsMenu.SelectedIndex++;
- if (creditsMenu.selectedIndex == creditsMenu.menuItems.Length)
- creditsMenu.selectedIndex = 0;
- }
- if (creditsMenu.CheckKey(Keys.Up, keyboardState2, oldKeyboardState2))
- {
- creditsMenu.selectedIndex--;
- if (creditsMenu.selectedIndex < 0)
- creditsMenu.selectedIndex = creditsMenu.menuItems.Length - 1;
- }
- if (creditsMenu.CheckKey(Keys.Enter, keyboardState2, oldKeyboardState2))
- {
- if (creditsMenu.SelectedIndex == 0)
- {
- gameState = 0;
- }
- }
- oldKeyboardState2 = keyboardState2;
- }
- private void UpdateSettings(GameTime gameTime)//menu pauzy
- {
- KeyboardState keyboardState2 = Keyboard.GetState();
- if (settingsMenu.CheckKey(Keys.Down, keyboardState2, oldKeyboardState2))
- {
- settingsMenu.SelectedIndex++;
- if (settingsMenu.selectedIndex == settingsMenu.menuItems.Length)
- settingsMenu.selectedIndex = 0;
- }
- if (settingsMenu.CheckKey(Keys.Up, keyboardState2, oldKeyboardState2))
- {
- settingsMenu.selectedIndex--;
- if (settingsMenu.selectedIndex < 0)
- settingsMenu.selectedIndex = settingsMenu.menuItems.Length - 1;
- }
- if (settingsMenu.CheckKey(Keys.Enter, keyboardState2, oldKeyboardState2))
- {
- if (settingsMenu.SelectedIndex == 0)
- {
- if (soundEnabled == 0)//on
- {
- soundEnabled = 1;
- menuInstance.Stop();
- string[] settingsItems = { "Sound " + onoff[soundEnabled], "Return" };
- settingsMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), settingsItems);
- }
- else
- {
- soundEnabled = 0;
- menuInstance.Play();
- string[] settingsItems = { "Sound " + onoff[soundEnabled], "Return" };
- settingsMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), settingsItems);
- }
- }
- else
- {
- gameState = 0;
- }
- }
- oldKeyboardState2 = keyboardState2;
- }
- private void UpdateGameSettings(GameTime gameTime)//menu pauzy
- {
- KeyboardState keyboardState2 = Keyboard.GetState();
- if (settingsPauseMenu.CheckKey(Keys.Down, keyboardState2, oldKeyboardState2))
- {
- settingsPauseMenu.SelectedIndex++;
- if (settingsPauseMenu.selectedIndex == settingsPauseMenu.menuItems.Length)
- settingsPauseMenu.selectedIndex = 0;
- }
- if (settingsPauseMenu.CheckKey(Keys.Up, keyboardState2, oldKeyboardState2))
- {
- settingsPauseMenu.selectedIndex--;
- if (settingsPauseMenu.selectedIndex < 0)
- settingsPauseMenu.selectedIndex = settingsPauseMenu.menuItems.Length - 1;
- }
- if (settingsPauseMenu.CheckKey(Keys.Enter, keyboardState2, oldKeyboardState2))
- {
- if (settingsPauseMenu.SelectedIndex == 0)
- {
- if (soundEnabled == 0)//on
- {
- soundEnabled = 1;
- pauseInstance.Stop();
- string[] pauseSettingsItems = { "Sound " + onoff[soundEnabled], "return" };
- settingsPauseMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), pauseSettingsItems);
- }
- else
- {
- soundEnabled = 0;
- pauseInstance.Play();
- string[] pauseSettingsItems = { "Sound " + onoff[soundEnabled], "return" };
- settingsPauseMenu = new MenuComponent(this, spriteBatch, Content.Load<SpriteFont>("myFont"), pauseSettingsItems);
- }
- }
- else
- {
- gameState = 4;
- }
- }
- oldKeyboardState2 = keyboardState2;
- }
- private void DrawMandy(GameTime gameTime)
- {
- Rectangle source;
- Rectangle destination;
- //animation here
- if(mandy.mCurrentState == State.Nothing)
- {
- //idle
- source = new Rectangle(1, 3, 29, 34);
- mandy.idle.previous_framechange += (float)gameTime.ElapsedGameTime.TotalSeconds;
- if (mandy.idle.previous_framechange > 0.2f)
- {
- if (gameState != 4 && gameState != 6)
- {
- mandy.idle.current_frame++;
- }
- if (mandy.idle.current_frame == mandy.idle.total_frames)
- {
- mandy.idle.current_frame = 0;
- }
- //zmiana klatki w obecnej
- mandy.idle.previous_framechange = 0f;
- //ustawiam inne animacje na 0
- }
- source = new Rectangle(30 * mandy.idle.current_frame, 3, 30, 34);
- }
- else if(mandy.mCurrentState == State.Walking)
- {
- mandy.walk.previous_framechange += (float)gameTime.ElapsedGameTime.TotalSeconds;
- //walk animation
- if (mandy.walk.previous_framechange > 0.2f)
- {
- //zmiana klatki w obecnej
- if (gameState != 4 && gameState != 6)
- {
- mandy.walk.current_frame++;
- }
- mandy.walk.previous_framechange = 0f;
- if (mandy.walk.current_frame == mandy.walk.total_frames)
- {
- mandy.walk.current_frame = 0;
- }
- }
- source = new Rectangle(30 * mandy.walk.current_frame, 39, 29, 36);
- }
- else if(mandy.mCurrentState == State.Jumping)
- {
- //just do shit right now
- if (mandy.mDirection.Y == 1)
- {
- //spadanie
- source = new Rectangle(1 + 60,78, 29, 35);
- }
- else
- {
- source = new Rectangle(1, 78, 29, 35);
- //lot w gore
- }
- }
- else
- {
- source = new Rectangle(1, 3, 29, 34);
- }
- //tu juz ustwilsmy ktora animiacja
- //i ktora klatka
- Color euzebiusz;
- if (mandy.mCurrentState == State.Hurt)
- {
- euzebiusz = Color.Red;
- mandy.mCurrentState = State.Nothing;
- }
- else
- {
- euzebiusz = Color.White;
- }
- destination = new Rectangle((int)mandy.position.X, (int)mandy.position.Y, 2 * source.Width, 2 * source.Height);
- if (mandy.direction == 1)
- {
- spriteBatch.Draw(playerTexture, destination, source, euzebiusz);
- }
- else
- {
- spriteBatch.Draw(playerTexture, destination, source, euzebiusz, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
- }
- }
- private void DrawScenery(GameTime thetime)//rysowanie terenu
- {
- for (int i = 0; i < stages[current_stage-1].ground_data.Count(); i++)
- {
- Rectangle one_block;
- Rectangle source_block;
- for (int j = 0; j < stages[current_stage - 1].ground_data[i].number_of_blocks; j++)
- {
- one_block = new Rectangle((int)stages[current_stage - 1].ground_data[i].position.X + j * stages[current_stage - 1].block_size, (int)stages[current_stage - 1].ground_data[i].position.Y, stages[current_stage - 1].block_size, stages[current_stage - 1].block_size);
- if (j == 0)
- {
- source_block = new Rectangle(0, 0, stages[current_stage - 1].block_size, stages[current_stage - 1].block_size);
- }
- else if (j == (stages[current_stage - 1].ground_data[i].number_of_blocks - 1))
- {
- //right edge texture
- source_block = new Rectangle(2 * stages[current_stage - 1].block_size, 0, stages[current_stage - 1].block_size, stages[current_stage - 1].block_size);
- }
- else
- {
- source_block = new Rectangle(stages[current_stage - 1].block_size, 0, stages[current_stage - 1].block_size, stages[current_stage - 1].block_size);
- //middle texture
- }
- spriteBatch.Draw(tileset, one_block, source_block, Color.White);
- }
- }
- for (int i = 0; i < stages[current_stage-1].food.Count(); i++)
- {
- Rectangle source;
- Rectangle destination;
- if (stages[current_stage - 1].food[i].type == 1)
- {
- source = new Rectangle(5, 3, 39, 39);
- //pizza
- }
- else if (stages[current_stage - 1].food[i].type == 2)
- {
- //fries
- source = new Rectangle(45, 3, 53, 42);
- }
- else
- {
- //burger
- source = new Rectangle(7, 44, 44, 52);
- }
- destination = new Rectangle((int)stages[current_stage - 1].food[i].position.X, (int)stages[current_stage - 1].food[i].position.Y - (int)source.Height, (int)source.Width, (int)source.Height);
- spriteBatch.Draw(food_texture, destination, source, Color.White);
- }
- //aurelisz
- for (int i = 0; i < stages[current_stage - 1].spikes_pos.Count(); i++)
- {
- Rectangle s;
- Rectangle d;
- s = new Rectangle(0, 0, 32, 32);
- d = new Rectangle((int)stages[current_stage - 1].spikes_pos[i].position.X, (int)stages[current_stage - 1].spikes_pos[i].position.Y, s.Width, s.Height);
- stages[current_stage - 1].spikes_pos[i].change_fequency+= (float)thetime.ElapsedGameTime.TotalSeconds;
- if (stages[current_stage - 1].spikes_pos[i].change_fequency > 1f)
- {
- stages[current_stage - 1].spikes_pos[i].change_fequency = 0f;
- if (stages[current_stage - 1].spikes_pos[i].active == true)
- {
- stages[current_stage - 1].spikes_pos[i].active = false;
- }
- else
- {
- stages[current_stage - 1].spikes_pos[i].active = true;
- }
- }
- if (stages[current_stage - 1].spikes_pos[i].active == true)
- {
- spriteBatch.Draw(spikes_texture, d, s, Color.White);
- }
- //aurelisz
- }
- for (int i = 0; i < stages[current_stage - 1].bonus_hearts.Count(); i++)
- {
- Rectangle s = new Rectangle(2, 4, 35, 30);
- Rectangle d = new Rectangle((int)stages[current_stage-1].bonus_hearts[i].position.X, (int)stages[current_stage-1].bonus_hearts[i].position.Y, s.Width, s.Height);
- spriteBatch.Draw(heart_b, d, s, Color.White);
- }
- }
- private void UpdateEnemies(GameTime thetime)
- {
- if (gameState != 4 && gameState != 6)
- {
- for (int i = 0; i < stages[current_stage - 1].enemies.Count(); i++)
- {
- stages[current_stage - 1].enemies[i].walk.previous_framechange += (float)thetime.ElapsedGameTime.TotalSeconds;
- stages[current_stage - 1].enemies[i].Update(thetime, stages[current_stage - 1].enemies[i].speed, stages[current_stage - 1].enemies[i].direction);
- if (((int)stages[current_stage - 1].enemies[i].position.X + 110 - stages[current_stage - 1].enemies[i].startX) > stages[current_stage - 1].enemies[i].range)
- {
- stages[current_stage - 1].enemies[i].direction.X = -1;
- }
- else if ((int)stages[current_stage - 1].enemies[i].position.X < stages[current_stage - 1].enemies[i].startX)
- {
- stages[current_stage - 1].enemies[i].direction.X = 1;
- }
- if (stages[current_stage - 1].enemies[i].walk.previous_framechange > 0.2f)
- {
- stages[current_stage - 1].enemies[i].walk.current_frame++;
- stages[current_stage - 1].enemies[i].walk.previous_framechange = 0f;
- if (stages[current_stage - 1].enemies[i].walk.current_frame == stages[current_stage - 1].enemies[i].walk.total_frames)
- {
- stages[current_stage - 1].enemies[i].walk.current_frame = 0;
- }
- }
- }
- }
- }
- private void DrawEnemies(GameTime thetime)
- {
- for (int i = 0; i < stages[current_stage - 1].enemies.Count(); i++)
- {
- Rectangle destination;
- Rectangle source;
- if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.purple_ponny))
- {
- source = new Rectangle(114 * stages[current_stage - 1].enemies[i].walk.current_frame, 114 * 2 - 5, 115, 112);
- destination = new Rectangle((int)stages[current_stage - 1].enemies[i].position.X, (int)stages[current_stage - 1].enemies[i].position.Y, 113, 110);
- }
- else if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.blue_ponny))
- {
- //tutaj rysowanie wrogow
- source = new Rectangle(114 * stages[current_stage - 1].enemies[i].walk.current_frame, 115, 115, 112);
- destination = new Rectangle((int)stages[current_stage - 1].enemies[i].position.X, (int)stages[current_stage - 1].enemies[i].position.Y, 113, 110);
- }
- else if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.yellow_ponny))
- {
- //tutaj rysowanie wrogow
- source = new Rectangle(114 * stages[current_stage - 1].enemies[i].walk.current_frame, 0, 115, 112);
- destination = new Rectangle((int)stages[current_stage - 1].enemies[i].position.X, (int)stages[current_stage - 1].enemies[i].position.Y, 113, 110);
- }
- else if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.shooter_purlpe))
- {
- source = new Rectangle(140 * stages[current_stage - 1].enemies[i].walk.current_frame, 0, 139, 139);
- destination = new Rectangle((int)stages[current_stage - 1].enemies[i].position.X, (int)stages[current_stage - 1].enemies[i].position.Y, 140, 140);
- stages[current_stage - 1].enemies[i].lastshoot += (float)thetime.ElapsedGameTime.TotalSeconds;
- if (stages[current_stage - 1].enemies[i].lastshoot > 4f)
- {
- stages[current_stage - 1].enemies[i].lastshoot = 0f;
- shoot kasia = new shoot(stages[current_stage - 1].enemies[i].position.X, stages[current_stage - 1].enemies[i].position.Y + 60, stage1.enemies[i].direction.X, true);
- enemyBullets.Add(kasia);
- }
- }
- else
- {
- //jak nie wiadomo ktory to zolty
- source = new Rectangle(114 * stages[current_stage - 1].enemies[i].walk.current_frame, 115, 115, 112);
- destination = new Rectangle((int)stages[current_stage - 1].enemies[i].position.X, (int)stages[current_stage - 1].enemies[i].position.Y, 113, 110);
- }
- if (stages[current_stage - 1].enemies[i].direction.X > 0)
- {
- if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.shooter_purlpe))
- {
- spriteBatch.Draw(pusia, destination, source, Color.White);
- }
- else
- {
- spriteBatch.Draw(enemy_texture, destination, source, Color.White);
- }
- }
- else
- {
- if (stages[current_stage - 1].enemies[i].whoami.Equals(enemies.shooter_purlpe))
- {
- spriteBatch.Draw(pusia, destination, source, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
- }
- else
- {
- spriteBatch.Draw(enemy_texture, destination, source, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
- }
- }
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- private void DrawText()//rysowanie interface'u
- {
- if (gameState == 1 || gameState == 3)
- {
- spriteBatch.DrawString(font, "LEVEL " + current_stage.ToString(), new Vector2(20, 0), Color.Black);
- spriteBatch.DrawString(font, "SCORE: " + score.ToString(), new Vector2(20, 31), Color.Black);
- spriteBatch.DrawString(pauseFont, "[P]ause", new Vector2(720, 40), Color.Black);
- }
- }
- public void DrawMenu(GameTime gameTime)//rysowanie menu
- {
- if (tocontinue == 0)
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(menuBackground, background, Color.White);
- spriteBatch.End();
- Vector2 location = menu.position;
- Color tint;
- for (int i = 0; i < menu.menuItems.Length; i++)
- {
- if (i == menu.selectedIndex)
- tint = menu.hilite;
- else
- tint = menu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(menu.spriteFont, menu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += menu.spriteFont.LineSpacing + 5;
- }
- }
- else
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(menuBackground, background, Color.White);
- spriteBatch.End();
- Vector2 location = menu.position;
- Color tint;
- for (int i = 0; i < continueMenu.menuItems.Length; i++)
- {
- if (i == continueMenu.selectedIndex)
- tint = continueMenu.hilite;
- else
- tint = continueMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(continueMenu.spriteFont, continueMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += continueMenu.spriteFont.LineSpacing + 5;
- }
- }
- }
- public void DrawGameMenu(GameTime gameTime)//rysowanie pauzy
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(gameMenuBackground, background, new Color(255,255,255,80));
- spriteBatch.End();
- Vector2 location = gameMenu.position;
- Color tint;
- for (int i = 0; i < gameMenu.menuItems.Length; i++)
- {
- if (i == gameMenu.selectedIndex)
- tint = gameMenu.hilite;
- else
- tint = gameMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(gameMenu.spriteFont, gameMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += gameMenu.spriteFont.LineSpacing + 5;
- }
- }
- public void DrawHiscores(GameTime gameTime)//rysowanie pauzy
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(hiscoresBackground, background, Color.White);
- spriteBatch.End();
- Vector2 location = new Vector2(350,450);
- Color tint;
- for (int i = 0; i < hiscoreMenu.menuItems.Length; i++)
- {
- if (i == hiscoreMenu.selectedIndex)
- tint = hiscoreMenu.hilite;
- else
- tint = hiscoreMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(menu.spriteFont, hiscoreMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += menu.spriteFont.LineSpacing + 5;
- }
- }
- public void DrawSettings(GameTime gameTime)//rysowanie pauzy
- {
- if (settingsMenu != null)
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(settingsBackground, background, Color.White);
- spriteBatch.End();
- Vector2 location = menu.position;
- Color tint;
- for (int i = 0; i < 2; i++)
- {
- if (i == settingsMenu.selectedIndex)
- tint = settingsMenu.hilite;
- else
- tint = settingsMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(menu.spriteFont, settingsMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += menu.spriteFont.LineSpacing + 5;
- }
- }
- }
- public void DrawCredits(GameTime gameTime)//rysowanie pauzy
- {
- if (creditsMenu != null)
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(creditsBackground, background, Color.White);
- spriteBatch.End();
- Vector2 location = new Vector2(350, 450);
- Color tint;
- for (int i = 0; i < 1; i++)
- {
- if (i == creditsMenu.selectedIndex)
- tint = creditsMenu.hilite;
- else
- tint = creditsMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(menu.spriteFont, creditsMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += menu.spriteFont.LineSpacing + 5;
- }
- }
- }
- public void DrawGamePause(GameTime gameTime)//rysowanie pauzy
- {
- if (settingsPauseMenu != null)
- {
- Rectangle background;
- background = new Rectangle(0, 0, screenWidth, screenHeight);
- spriteBatch.Begin();
- spriteBatch.Draw(gameMenuBackground, background, new Color(255, 255, 255, 80));
- spriteBatch.End();
- Vector2 location = menu.position;
- Color tint;
- for (int i = 0; i < 2; i++)
- {
- if (i == settingsPauseMenu.selectedIndex)
- tint = settingsPauseMenu.hilite;
- else
- tint = settingsPauseMenu.normal;
- spriteBatch.Begin();
- spriteBatch.DrawString(gameMenu.spriteFont, settingsPauseMenu.menuItems[i], location, tint);
- spriteBatch.End();
- location.Y += settingsPauseMenu.spriteFont.LineSpacing + 5;
- }
- }
- }
- /// <summary>
- /// Allows the game to run logic such as updating the world,
- /// checking for collisions, gathering input, and playing audio.
- /// </summary>
- /// <param name="gameTime">Provides a snapshot of timing values.</param>
- protected override void Update(GameTime gameTime)//update
- {
- // Allows the game to exit
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
- this.Exit();
- // TODO: Add your update logic here
- if (gameState == 0)
- {
- UpdateMenu(gameTime);
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- else if (gameState == 1)
- {
- if (gameInstance.State != SoundState.Playing && soundEnabled == 0)
- {
- gameInstance.Play();
- }
- }
- else if (gameState == 2)
- {
- //tu dodać odczyt z pliku
- //do stringa
- UpdateHiScores(gameTime);
- }
- else if (gameState == 3)
- {
- UpdateCredits(gameTime);
- }
- else if (gameState == 4)
- {
- UpdateGameMenu(gameTime);
- }
- else if (gameState == 5)
- {
- UpdateSettings(gameTime);
- }
- else if (gameState == 6)
- {
- UpdateGameSettings(gameTime);
- }
- UpdateEnemies(gameTime);
- UpdateInput(gameTime);
- if (gameState == 1)
- {
- fire();
- enemyFire();
- }
- if (mandy.position.Y >= screenHeight)
- {
- mandy.mCurrentState = State.Hurt;
- score += 150;
- mandy.hp--;
- }
- if (mandy.hp == 0)
- {
- gameState = 0;
- tocontinue = 0;
- gameInstance.Stop();
- score = 0;
- }
- if (mandy.mCurrentState == State.Hurt)
- {
- mandy.position = new Vector2(20, screenHeight - 90);
- score -= 250;
- RightScreenCoor = screenWidth;
- Camera.Transform = Matrix.Identity;
- Camera.UpdateMatrix = false;
- Camera.Position = new Vector2(0, 0);
- //Camera.Origin = new Vector2(screenWidth / 2, screenHeight / 2);
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- bulletsList.Clear();
- enemyBullets.Clear();
- mandy.mDirection.Y = 0;
- mandy.mCurrentState = State.Nothing;
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- // The time since Update was called last.
- float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
- // TODO: Add your game logic here.
- MyBackground.Update(elapsed * 50); //przesuwa pozycje tla, zwieksz liczbe, aby sunelo szybciej
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- Vector2 aDirection = new Vector2(-1, 0);
- Vector2 aSpeed = new Vector2(160, 0);
- base.Update(gameTime);
- }
- private void ProcessKeyboard(GameTime gameTime)//ogar klawiatury
- {
- if (gameState == 1)
- {
- mandy.Update(gameTime, ref RightScreenCoor, stages[current_stage - 1]);
- KeyboardState keybState = Keyboard.GetState();
- if (keybState.IsKeyDown(Keys.Space) == true && oldKeyboardState3.IsKeyDown(Keys.Space) == false)
- {
- shoot bullet = new shoot(mandy.position.X, mandy.position.Y + 18, mandy.direction,true);
- bulletsList.Add(bullet);
- //bullet.position.X = mandy.position.X;
- //bullet.position.Y = mandy.position.Y + 18;
- //bullet.direction = mandy.direction;
- //bullet.Visible = true;
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- if (shootInstance.State != SoundState.Playing && soundEnabled == 0)
- {
- shootInstance.Play();
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- }
- if (keybState.IsKeyDown(Keys.P))
- {
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- if (gameInstance.State == SoundState.Playing)
- {
- gameInstance.Stop();
- }
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>-------------
- gameMenu.SelectedIndex = 0;
- gameState = 4;
- }
- oldKeyboardState3 = keybState;
- }
- ////<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- }
- public void enemyFire()//strzał
- {
- for (int z = 0; z < enemyBullets.Count; z++)
- {
- //Kolizja z lewej
- if (enemyBullets[z].position.X + 30 >= mandy.position.X && enemyBullets[z].position.X <= mandy.position.X + 50 && enemyBullets[z].position.Y + 18 >= mandy.position.Y && enemyBullets[z].position.Y <= mandy.position.Y + 68)
- {
- mandy.mCurrentState = State.Hurt;
- mandy.hp--;
- break;
- }
- }
- for (int z = 0; z < enemyBullets.Count; z++)
- {
- if (enemyBullets[z].Visible == true)
- {
- if (enemyBullets[z].direction == 1)
- {
- enemyBullets[z].position.X += 15;
- }
- else
- {
- enemyBullets[z].position.X -= 15;
- }
- }
- if (enemyBullets[z].position.X >= RightScreenCoor)
- {
- enemyBullets.RemoveAt(z);
- z--;
- if (z <= -1)
- {
- z = 0;
- }
- }
- else if (enemyBullets[z].position.X <= RightScreenCoor - screenWidth)
- {
- enemyBullets.RemoveAt(z);
- z--;
- if (z <= -1)
- {
- z = 0;
- }
- }
- }
- }
- public void fire()//strzał
- {
- for (int i = 0; i < bulletsList.Count; i++)
- {
- for (int j = 0; j < stages[current_stage - 1].enemies.Count; j++)
- {
- //Kolizja z lewej
- if (bulletsList[i].position.X + 30 >= stages[current_stage - 1].enemies[j].position.X && bulletsList[i].position.X <= stages[current_stage - 1].enemies[j].position.X + 100 && bulletsList[i].position.Y + 18 >= stages[current_stage - 1].enemies[j].position.Y && bulletsList[i].position.Y <= stages[current_stage - 1].enemies[j].position.Y + 100)
- {
- score += 500;
- bulletsList.RemoveAt(i);
- i--;
- if (i <= -1)
- {
- i = 0;
- }
- else if (i >= bulletsList.Count)
- {
- i = bulletsList.Count - 1;
- }
- stages[current_stage - 1].enemies.RemoveAt(j);
- j--;
- if (j <= -1)
- {
- j = 0;
- }
- else if (j >= stages[current_stage - 1].enemies.Count)
- {
- j = stages[current_stage - 1].enemies.Count - 1;
- }
- if (bulletsList.Count == 0)
- {
- break;
- }
- }
- }
- }
- for (int i = 0; i < bulletsList.Count; i++)
- {
- if (bulletsList[i].Visible == true)
- {
- if (bulletsList[i].direction == 1)
- {
- bulletsList[i].position.X += 15;
- }
- else
- {
- bulletsList[i].position.X -= 15;
- }
- }
- if (bulletsList[i].position.X >= RightScreenCoor)
- {
- bulletsList.RemoveAt(i);
- i--;
- if (i <= -1)
- {
- i = 0;
- }
- }
- else if (bulletsList[i].position.X <= RightScreenCoor - screenWidth)
- {
- bulletsList.RemoveAt(i);
- i--;
- if (i <= -1)
- {
- i = 0;
- }
- }
- }
- }
- private void UpdateInput(GameTime gameTime)//nie wiem co to tu wogle robi :P
- {
- ProcessKeyboard(gameTime);
- }
- public void DrawBullet()//rysowanie strzału
- {
- for (int i = 0; i < bulletsList.Count; i++)
- {
- if (bulletsList[i].direction == 1)
- {
- Rectangle bulletR = new Rectangle((int)bulletsList[i].position.X, (int)bulletsList[i].position.Y, bulletTexture.Width, bulletTexture.Height);
- spriteBatch.Draw(bulletTexture, bulletR, Color.White);
- }
- else
- {
- Rectangle bulletR = new Rectangle((int)bulletsList[i].position.X, (int)bulletsList[i].position.Y, bulletTexture.Width, bulletTexture.Height);
- spriteBatch.Draw(bulletTexture, bulletR, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
- }
- }
- for (int i = 0; i < enemyBullets.Count; i++)
- {
- if (enemyBullets[i].direction == 1)
- {
- Rectangle bulletR = new Rectangle((int)enemyBullets[i].position.X, (int)enemyBullets[i].position.Y, bulletTexture.Width, bulletTexture.Height);
- spriteBatch.Draw(bulletTexture, bulletR, Color.White);
- }
- else
- {
- Rectangle bulletR = new Rectangle((int)enemyBullets[i].position.X, (int)enemyBullets[i].position.Y, bulletTexture.Width, bulletTexture.Height);
- spriteBatch.Draw(bulletTexture, bulletR, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
- }
- }
- }
- /// <summary>
- /// This is called when the game should draw itself.
- /// </summary>
- /// <param name="gameTime">Provides a snapshot of timing values.</param>
- protected override void Draw(GameTime gameTime)//rysowanie
- {
- GraphicsDevice.Clear(Color.CornflowerBlue);
- if (gameState == 0)
- {
- DrawMenu(gameTime);
- }
- else if (gameState == 2)//hiscores
- {
- DrawHiscores(gameTime);
- }
- else if (gameState == 3)//Credits
- {
- DrawCredits(gameTime);
- }
- else if (gameState == 5)//Settings
- {
- DrawSettings(gameTime);
- }
- else
- {
- spriteBatch.Begin();
- MyBackground.Draw(spriteBatch);
- spriteBatch.End();
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.TransformMatrix());
- //<><><><<><><><><><><><><><><><><><><><><><><><><><><><><><><<>><><><><><><><><><><><><><><><><>
- DrawScenery(gameTime);
- DrawBullet();
- DrawEnemies(gameTime);
- DrawMandy(gameTime);
- spriteBatch.End();
- spriteBatch.Begin();
- mandy.drawHP(heartTexture, screenHeight, screenWidth, spriteBatch);
- DrawText();
- spriteBatch.End();
- if (gameState == 4)
- {
- DrawGameMenu(gameTime);
- }
- else if (gameState == 6)
- {
- DrawGamePause(gameTime);
- }
- // TODO: Add your drawing code here
- }
- base.Draw(gameTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment