Games by younger me

Started by
14 comments, last by Josip Mati? 10 years, 8 months ago

Well, I've found my old projects and, naturally, couldn't comprehend my younger self's way of thinking. I wrote an entire journal entry about that so I won't ramble about it.

However, I want to highlight one particular insanity I produced... not that long time ago, actually. While my first game's code is bad because... well, I was about 15 years old at that time and didn't know much about programming (I was self taught), this abomination was written about 3 years ago when I entered faculty (college).

Behold, the Uruk-Hai of programming:


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;

namespace Mlin
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        // Graphics specific variables
        public Texture2D Board;
        public Texture2D Figure;
        public Texture2D Background;
        public Rectangle BoardRect;
        public Double GraphicScale;
        public Vector2 FigurePosition;
        public Vector2 FigureOffset;
        public string Gamestate;
        public Color Player1Color;
        public Color Player2Color;

        // Game logic variables
        public Char[,] FigurePlacement = new char[7,7];
        public byte PlayerTurn;
        public bool PositionPhase = true;
        public byte FigureCount1 = 0;
        public byte FigureCount2 = 0;
        public bool Selected = false;
        public byte SelectedPos;
        public byte x, y;

        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()
        {
            // TODO: Add your initialization logic here

            graphics.PreferredBackBufferHeight = 800;
            graphics.PreferredBackBufferWidth = 800;
            graphics.ApplyChanges();
            IsMouseVisible = true;

            PlayerTurn = 1;
            Player1Color = Color.Red;
            Player2Color = Color.Blue;

            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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            Board = Content.Load<Texture2D>("Images/Board");
            Figure = Content.Load<Texture2D>("Images/Figure");

            // Setup
            BoardRect.Width = graphics.PreferredBackBufferWidth;
            BoardRect.Height = graphics.PreferredBackBufferHeight;
            BoardRect.X = 0; BoardRect.Y = 0;
            GraphicScale = (double) graphics.PreferredBackBufferHeight / Board.Height;
            FigureOffset.X = Figure.Bounds.Center.X; FigureOffset.Y = Figure.Bounds.Center.Y;
        }

        /// <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
        }

        /// <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)
        {
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                this.Exit();

            // TODO: Add your update logic here

            if (Mouse.GetState().LeftButton == ButtonState.Pressed && PositionPhase == true)
            {
                #region Positions
                            // First line
                            if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[0, 0] == '\0') { FigurePlacement[0, 0] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[0, 0] == '\0') { FigurePlacement[0, 0] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 0] == '\0') { FigurePlacement[3, 0] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 0] == '\0') { FigurePlacement[3, 0] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[6, 0] == '\0') { FigurePlacement[6, 0] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[6, 0] == '\0') { FigurePlacement[6, 0] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // Second line
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[1, 1] == '\0') { FigurePlacement[1, 1] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[1, 1] == '\0') { FigurePlacement[1, 1] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 1] == '\0') { FigurePlacement[3, 1] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 1] == '\0') { FigurePlacement[3, 1] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[5, 1] == '\0') { FigurePlacement[5, 1] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[5, 1] == '\0') { FigurePlacement[5, 1] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // Third line
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[2, 2] == '\0') { FigurePlacement[2, 2] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[2, 2] == '\0') { FigurePlacement[2, 2] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 2] == '\0') { FigurePlacement[3, 2] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 2] == '\0') { FigurePlacement[3, 2] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[4, 2] == '\0') { FigurePlacement[4, 2] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[4, 2] == '\0') { FigurePlacement[4, 2] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // 4th line
                            else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[0, 3] == '\0') { FigurePlacement[0, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[0, 3] == '\0') { FigurePlacement[0, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[1, 3] == '\0') { FigurePlacement[1, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[1, 3] == '\0') { FigurePlacement[1, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[2, 3] == '\0') { FigurePlacement[2, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[2, 3] == '\0') { FigurePlacement[2, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[4, 3] == '\0') { FigurePlacement[4, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[4, 3] == '\0') { FigurePlacement[4, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[5, 3] == '\0') { FigurePlacement[5, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[5, 3] == '\0') { FigurePlacement[5, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[6, 3] == '\0') { FigurePlacement[6, 3] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[6, 3] == '\0') { FigurePlacement[6, 3] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // 5th line
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[2, 4] == '\0') { FigurePlacement[2, 4] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[2, 4] == '\0') { FigurePlacement[2, 4] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 4] == '\0') { FigurePlacement[3, 4] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 4] == '\0') { FigurePlacement[3, 4] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[4, 4] == '\0') { FigurePlacement[4, 4] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[4, 4] == '\0') { FigurePlacement[4, 4] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // 6th line
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[1, 5] == '\0') { FigurePlacement[1, 5] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[1, 5] == '\0') { FigurePlacement[1, 5] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 5] == '\0') { FigurePlacement[3, 5] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 5] == '\0') { FigurePlacement[3, 5] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[5, 5] == '\0') { FigurePlacement[5, 5] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[5, 5] == '\0') { FigurePlacement[5, 5] = '2'; ++FigureCount2; PlayerTurn = 1; }

                            // Last line
                            else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[0, 6] == '\0') { FigurePlacement[0, 6] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[0, 6] == '\0') { FigurePlacement[0, 6] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[3, 6] == '\0') { FigurePlacement[3, 6] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[3, 6] == '\0') { FigurePlacement[3, 6] = '2'; ++FigureCount2; PlayerTurn = 1; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 1 && FigurePlacement[6, 6] == '\0') { FigurePlacement[6, 6] = '1'; ++FigureCount1; PlayerTurn = 2; }
                            else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale)) && PlayerTurn == 2 && FigurePlacement[6, 6] == '\0') { FigurePlacement[6, 6] = '2'; ++FigureCount2; PlayerTurn = 1; }
                #endregion
                if (FigureCount1 == 9 && FigureCount2 == 9) PositionPhase = false;
            }
            if (Mouse.GetState().LeftButton == ButtonState.Pressed && PositionPhase == false)
            {
            #region Selection decider
                if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale))) {SelectedPos = 1;}
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale))) {SelectedPos = 2;}
                else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(175 * GraphicScale)) && Mouse.GetState().Y < ((int)(325 * GraphicScale))) {SelectedPos = 3;}
                else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale))) {SelectedPos = 4;}
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale))) {SelectedPos = 5;}
                else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(375 * GraphicScale)) && Mouse.GetState().Y < ((int)(525 * GraphicScale))) {SelectedPos = 6;}
                else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale))) {SelectedPos = 7;}
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale))) {SelectedPos = 8;}
                else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(575 * GraphicScale)) && Mouse.GetState().Y < ((int)(725 * GraphicScale))) {SelectedPos = 9;}
                else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 10; }
                else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 11; }
                else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 12; }
                else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 13; }
                else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 14; }
                else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(925 * GraphicScale)) && Mouse.GetState().Y < ((int)(1075 * GraphicScale))) { SelectedPos = 15; }
                else if (Mouse.GetState().X > ((int)(575 * GraphicScale)) && Mouse.GetState().X < ((int)(725 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale))) { SelectedPos = 16; }
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale))) { SelectedPos = 17; }
                else if (Mouse.GetState().X > ((int)(1275 * GraphicScale)) && Mouse.GetState().X < ((int)(1425 * GraphicScale)) && Mouse.GetState().Y > ((int)(1275 * GraphicScale)) && Mouse.GetState().Y < ((int)(1425 * GraphicScale))) { SelectedPos = 18; }
                else if (Mouse.GetState().X > ((int)(375 * GraphicScale)) && Mouse.GetState().X < ((int)(525 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale))) { SelectedPos = 19; }
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale))) { SelectedPos = 20; }
                else if (Mouse.GetState().X > ((int)(1475 * GraphicScale)) && Mouse.GetState().X < ((int)(1625 * GraphicScale)) && Mouse.GetState().Y > ((int)(1475 * GraphicScale)) && Mouse.GetState().Y < ((int)(1625 * GraphicScale))) { SelectedPos = 21; }
                else if (Mouse.GetState().X > ((int)(175 * GraphicScale)) && Mouse.GetState().X < ((int)(325 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale))) { SelectedPos = 22; }
                else if (Mouse.GetState().X > ((int)(925 * GraphicScale)) && Mouse.GetState().X < ((int)(1075 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale))) { SelectedPos = 23; }
                else if (Mouse.GetState().X > ((int)(1675 * GraphicScale)) && Mouse.GetState().X < ((int)(1825 * GraphicScale)) && Mouse.GetState().Y > ((int)(1675 * GraphicScale)) && Mouse.GetState().Y < ((int)(1825 * GraphicScale))) { SelectedPos = 24; }
            #endregion
            }
            base.Update(gameTime);
                         
        }     
 

        /// <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)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            spriteBatch.Draw(Board, BoardRect, Color.Yellow);
            #region Figure drawing

            // First line
            if (FigurePlacement[0, 0] == '1')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color , 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[0, 0] == '2')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 0] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 0] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 0] == '1')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 0] == '2')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(250 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // Second line
            if (FigurePlacement[1, 1] == '1')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[1, 1] == '2')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 1] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 1] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 1] == '1')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 1] == '2')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(450 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // 3rd line
            if (FigurePlacement[2, 2] == '1')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[2, 2] == '2')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 2] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 2] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            } 
            if (FigurePlacement[4, 2] == '1')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[4, 2] == '2')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(650 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // 4th line
            if (FigurePlacement[0, 3] == '1')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[0, 3] == '2')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[1, 3] == '1')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[1, 3] == '2')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[2, 3] == '1')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[2, 3] == '2')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[4, 3] == '1')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[4, 3] == '2')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 3] == '1')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 3] == '2')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 3] == '1')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 3] == '2')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(1000 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // 5th line
            if (FigurePlacement[2, 4] == '1')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[2, 4] == '2')
            {
                FigurePosition.X = (int)(650 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            } 
            if (FigurePlacement[3, 4] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 4] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[4, 4] == '1')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[4, 4] == '2')
            {
                FigurePosition.X = (int)(1350 * GraphicScale); FigurePosition.Y = (int)(1350 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // 6th line
            if (FigurePlacement[1, 5] == '1')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[1, 5] == '2')
            {
                FigurePosition.X = (int)(450 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 5] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 5] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 5] == '1')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[5, 5] == '2')
            {
                FigurePosition.X = (int)(1550 * GraphicScale); FigurePosition.Y = (int)(1550 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }

            // Last line
            if (FigurePlacement[0, 6] == '1')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[0, 6] == '2')
            {
                FigurePosition.X = (int)(250 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 6] == '1')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[3, 6] == '2')
            {
                FigurePosition.X = (int)(1000 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 6] == '1')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player1Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            if (FigurePlacement[6, 6] == '2')
            {
                FigurePosition.X = (int)(1750 * GraphicScale); FigurePosition.Y = (int)(1750 * GraphicScale);
                spriteBatch.Draw(Figure, FigurePosition, null, Player2Color, 0.0f, FigureOffset, (float)GraphicScale, SpriteEffects.None, 0);
            }
            #endregion
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}

And the result?

[spoiler]

2irr76o.jpg

[/spoiler]

No wonder I gave up on it.

If I would write it right now, I would make field on board as its own class. That way, in main code I can simply hold a list of fields and manipulate with it, instead of... doing... what I did.

Advertisement

ah, if only i had the code from some of my very earliest games, they were travesty's to say the least. (i once wrote risk in lua, with no concept of loops, and functions....the file was well over several megs big, had multiple repeated sections of code, and was so incredibly bloated, it only partially functioned, but overall was just....terrible...*shudders*)

is this game based on some existing game, or is it an original construction?

edit: i should re-phase, because i do think i may have had an understanding of functions at the time, but not how to utilize them correctly, which lead to me re-writing massive portions of the game, that could have been neatly summed into functions. also, combined with no real knowledge of for-loops i was hand-writing massive loops, and hard-coding country borders.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

It's pure copy of Nine Men's Morris board game. It was easier for me (and still is; there is still long way to go for me to design new games) to use existing games as a core or entire project. It should've been easy to "convert" it into digital format due to its simple board and rules. I just had to use that thing in my head called "brain".

Oh well, everybody has to start from somewhere, right? XD

EDIT: Even today, I still find myself not utilizing what C# has to offer and instead rewriting massive pieces of code. I passed several times over the code of Battle City and found numerous situations where I could (and did) eliminate copies of code and replace them with one or two methods which do the same job, but better. In the above code, all that placement could easily be summarized into 1 void method with 2 to 4 parameters, instead of doing massive if...then...else if.. tree which is insanely hard to read.

You deserve an upvote just because of " the Uruk-Hai of programming:" lmfao

This is gonna be hard to beat, but look at my first games Menu.h file :P This was written about 3 years ago as well :P The funny part, game works perfectly fine here is a video of it


int CampControls()
{
  if ( CharacterMenuOpen == false)
  {
  if (EnterShop == false)
  {
  if ( MapMenuOpen == false)
  {    
  if (menu == 1) 
  {
   if (Battle == false)
   {
       if (key[SDLK_DOWN])
       {
        if (campDownKey == 1)
        {
          if (CampCursorCord.y != 544)
          {
             CampCursorCord.y = CampCursorCord.y + 39;
             campDownKey = 2;
               Mix_PlayChannel(2, MenuChoice, 0);
          }  
          }
       }
       if (!key[SDLK_DOWN])
       {
           campDownKey = 1;
       }
       
       if (key[SDLK_UP])
       {
        if(campUpKey == 1)
        {
          if (CampCursorCord.y != 388) 
          {           
             CampCursorCord.y = CampCursorCord.y - 39;
                Mix_PlayChannel(2, MenuChoice, 0);
          }
          campUpKey = 2;
          }
        }
        if (!key[SDLK_UP])
        {
           campUpKey =1;
        }
        
        
       if (key[SDLK_RETURN])
       {
                if (campEnterKey == 1)
             {
        if (active == false)
        {
           if (CampCursorCord.y == 388)
           {
              Find1 = true;
               Mix_PlayChannel(2, MenuChoice, 0);
               MapMenuOpen = true;
                 campEnterKey = 2; 
              CampCursorCord.y = 542;
           }
           if (CampCursorCord.y == 427)
           {//char  stats
                 Mix_PlayChannel(2, MenuChoice, 0);
             CharacterMenuOpen = true;
             CampCursorCord.y = 494;
             campEnterKey = 2;
           }
           if (CampCursorCord.y == 466)
           {
                  Mix_PlayChannel(2, MenuChoice, 0);
                  CampCursorCord.y = 503;
           //Shop
           EnterShop = true;
             campEnterKey = 2;
           }
           if (CampCursorCord.y == 505)
           {
              RestCheck = gold - RestCost;
              if (RestCheck >= 0)
              {
              StopCampM = true;
               Mix_PlayChannel(-1, NightToDay, 0);
            // Mix_HaltMusic();
              active = true;
              campEnterKey = 2;
              }
              else
              Mix_PlayChannel(2, MenuChoice, 0);
           }
           if (CampCursorCord.y == 544)
           {
              Mix_PlayChannel(2, MenuChoice, 0);
              CampCursorCord.y = 495;
              menu = 2;
              campEnterKey = 2;
           }
           }

           }
         }
                     if (!key[SDLK_RETURN])
         {
            campEnterKey = 1;
         }
       }
       }
   }   
}
}

if ((EnterBuy == false) && (EnterSell == false))
{
if (EnterShop == true)
{
   SDL_BlitSurface (BuySellChoice, NULL, screen, &BuySellChoiceCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
         if (campUpKey == 1)
         {
           if (key[SDLK_UP])
           {
              if (CampCursorCord.y > 423)
              {
              Mix_PlayChannel(2, MenuChoice, 0);
              CampCursorCord.y = CampCursorCord.y - 40;
              campUpKey = 2;
              }
           }
         }
         if (!key[SDLK_UP])
         {
            campUpKey = 1;
         }
         
         if (campDownKey == 1)
         {
           if (key[SDLK_DOWN])
           {
             if (CampCursorCord.y < 503)
             {
              Mix_PlayChannel(2, MenuChoice, 0);
              CampCursorCord.y = CampCursorCord.y + 40;
              campDownKey = 2;
              }
           }
         }
         if (!key[SDLK_DOWN])
         {
            campDownKey = 1;
         }
         
         if (campEnterKey == 1)
         {
           if (key[SDLK_RETURN])
           {
             if (CampCursorCord.y == 423)
             {
              //buy
              EnterBuy = true;
              CampCursorCord.y = 507;
              Mix_PlayChannel(2, MenuChoice, 0);
              campEnterKey = 2;
             }
             if (CampCursorCord.y ==463)
             {
             //sell
             EnterSell = true;
             CampCursorCord.y = 507;
               Mix_PlayChannel(2, MenuChoice, 0);
              campEnterKey = 2;                  
             }
             if( CampCursorCord.y == 503)
             {
             //back
             Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = 466;
             EnterShop = false;                    
             campEnterKey = 2;
            }
           }
         }
         if (!key[SDLK_RETURN])
         {
            campEnterKey = 1;
         }
}
}

if (EnterBuyEquipment == false)
{
if (EnterBuy == true)
{
   SDL_BlitSurface (EquipmentItemsChoice, NULL, screen, &EquipmentItemsChoiceCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
    BuyTxt = TTF_RenderText_Solid(MinionProBold2, "Buy", NormalColor);
    SDL_BlitSurface(BuyTxt,NULL,screen, &BuyTxtCord);

       if (campUpKey == 1)
       {
         if (key[SDLK_UP])
         {
             if (CampCursorCord.y > 429)
             {
              Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = CampCursorCord.y - 39;
             campUpKey = 2;
             }
         }
       }
       if (!key[SDLK_UP])
       {
        campUpKey = 1;
       }
       
       if (campDownKey == 1)
       {
         if (key[SDLK_DOWN])
         {   
             if (CampCursorCord.y < 507)
             {
              Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = CampCursorCord.y + 39;
             campDownKey = 2;
             }
         }
       }
       if (!key[SDLK_DOWN])
       {
        campDownKey = 1;
       }
       
         if (campEnterKey == 1)
         {
           if (key[SDLK_RETURN])
           {         
                   if (CampCursorCord.y == 429)
                  {
                  // buy equipment
                  EnterBuyEquipment = true;
                 CampCursorCord.y = 501;
                   CampCursorCord.x = 96;
                  Mix_PlayChannel(2, MenuChoice, 0);
                  campEnterKey = 2;                 
             }
             if (CampCursorCord.y == 468)
             {
                 //buy items
                  Mix_PlayChannel(2, MenuChoice, 0);
                  campEnterKey = 2;    
             }
             if (CampCursorCord.y == 507)
             {
             //back
             Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = 423;
             EnterBuy = false;
             EnterShop = true;                    
             campEnterKey = 2;
             }
           }
         }
         if (!key[SDLK_RETURN])
         {
            campEnterKey = 1;
         }
}
}

if (EnterSellEquipment == false)
{
if (EnterSell == true)
{
   SDL_BlitSurface (EquipmentItemsChoice, NULL, screen, &EquipmentItemsChoiceCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
   SellTxt = TTF_RenderText_Solid(MinionProBold2, "Sell", NormalColor);
   SDL_BlitSurface(SellTxt,NULL,screen, &SellTxtCord);
    if (campUpKey == 1)
       {
         if (key[SDLK_UP])
         {
             if (CampCursorCord.y > 429)
             {
              Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = CampCursorCord.y - 39;
             campUpKey = 2;
             }
         }
       }
       if (!key[SDLK_UP])
       {
        campUpKey = 1;
       }
       
       if (campDownKey == 1)
       {
         if (key[SDLK_DOWN])
         {   
             if (CampCursorCord.y < 507)
             {
              Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = CampCursorCord.y + 39;
             campDownKey = 2;
             }
         }
       }
       if (!key[SDLK_DOWN])
       {
        campDownKey = 1;
       }
            if (campEnterKey == 1)
         {
           if (key[SDLK_RETURN])
           {
             if (CampCursorCord.y == 429)
             {
                  // sell equipment
                   EnterSellEquipment = true;
                   CampCursorCord.y = 501;
                   CampCursorCord.x = 96;
                  Mix_PlayChannel(2, MenuChoice, 0);
                  campEnterKey = 2;                 
             }
             if (CampCursorCord.y == 468)
             {
                 //sell items
                  Mix_PlayChannel(2, MenuChoice, 0);
                  campEnterKey = 2;  
             }
              if (CampCursorCord.y == 507)
             {
             //back
             Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = 463;
             EnterSell = false;
             EnterShop = true;                    
             campEnterKey = 2;
           }
           }
         }
         if (!key[SDLK_RETURN])
         {
            campEnterKey = 1;
         }
}
}

if (EnterBuyEquipment == true)
{
   SDL_BlitSurface (BuyEquipment, NULL, screen, &BuySellEquipmentCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
   BuyTxt = TTF_RenderText_Solid(MinionProBold, "Buy", NormalColor);
   SDL_BlitSurface(BuyTxt,NULL,screen, &SellTxt2Cord);
    if (CampCursorCord.y == 467)
    { //Beginner gear 
      BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      
      LeatherSetFound = TTF_RenderText_Solid(MinionPro, "Leather Set", NormalColor);
      SDL_BlitSurface(LeatherSetFound,NULL,screen, &Buy1Cord);
      
      LeatherPrice = TTF_RenderText_Solid(MinionPro, "30", GoldColor);
      SDL_BlitSurface(LeatherPrice,NULL,screen, &Price1Cord);
       
      RustyDaggerFound =TTF_RenderText_Solid(MinionPro, "Rusty Dagger", NormalColor);
      SDL_BlitSurface(RustyDaggerFound, NULL, screen, &Buy2Cord);
      
      RustyDaggerPrice = TTF_RenderText_Solid(MinionPro, "20", GoldColor);
      SDL_BlitSurface(RustyDaggerPrice,NULL,screen, &Price2Cord);
      
      DaggerFound =TTF_RenderText_Solid(MinionPro, "Dagger", NormalColor);
      SDL_BlitSurface(DaggerFound, NULL, screen, &Buy3Cord);
      
      DaggerPrice =TTF_RenderText_Solid(MinionPro, "50", GoldColor);
      SDL_BlitSurface(DaggerPrice, NULL, screen, &Price3Cord);
    } 
    if (CampCursorCord.y == 433)
    { 
    if (CurrentLevel >= 5)
    {
                         // apprentice
     PoisonSwordFound =TTF_RenderText_Solid(MinionPro, "Poison Sword", NormalColor);
     SDL_BlitSurface(PoisonSwordFound, NULL, screen, &Buy3Cord);
          
      PoisonSwordPrice =TTF_RenderText_Solid(MinionPro, "250", GoldColor);
      SDL_BlitSurface(PoisonSwordPrice, NULL, screen, &Price3Cord);
      
     ShadowRobeFound =TTF_RenderText_Solid(MinionPro, "Shadow Robe", NormalColor);
     SDL_BlitSurface(ShadowRobeFound, NULL, screen, &Buy2Cord);
          
     ShadowRobePrice =TTF_RenderText_Solid(MinionPro, "300", GoldColor);
      SDL_BlitSurface(ShadowRobePrice, NULL, screen, &Price2Cord);
      
     RockPlateFound =TTF_RenderText_Solid(MinionPro, "Rock Plate", NormalColor);
     SDL_BlitSurface(RockPlateFound, NULL, screen, &Buy1Cord);
     
          RockPlatePrice =TTF_RenderText_Solid(MinionPro, "250", GoldColor);
      SDL_BlitSurface(RockPlatePrice, NULL, screen, &Price1Cord);     
     
     
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
     SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
     }
     if (CurrentLevel < 5)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
    if (CampCursorCord.y == 399)
    {
    if (CurrentLevel >= 15)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 15)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
    if (CampCursorCord.y == 365)
    {
    if (CurrentLevel >=20)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
    }
         if (CurrentLevel < 20)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
   }

    if (CampCursorCord.y == 331)
    {
        if (CurrentLevel >=25)
    {
    BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 25)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
    if (CampCursorCord.y == 297)
    {
      if (CurrentLevel >=30)
      {
        BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
        SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 30)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    if (CampCursorCord.y == 263)
    {
    if (CurrentLevel >= 35)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 35)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    if ((EnterApprentice == false) && (EnterBeginner == false))
    {
    
     if (campUpKey == 1)
     {
       if (key[SDLK_UP])
       {
          if (CampCursorCord.y > 263)
          {
           Mix_PlayChannel(2, MenuChoice, 0);
          CampCursorCord.y = CampCursorCord.y - 34;
          campUpKey = 2;
          }
       }
     }
     if (!key[SDLK_UP])
     {
       campUpKey = 1;
     }
     if (campDownKey == 1)
     {
        if (key[SDLK_DOWN])
        {
           if (CampCursorCord.y < 501)
           {
            Mix_PlayChannel(2, MenuChoice, 0);
           CampCursorCord.y = CampCursorCord.y + 34;
           campDownKey = 2;
           }
        }
     }
     if (!key[SDLK_DOWN])
     {
      campDownKey = 1;
     }
     
     if (campEnterKey == 1)
     {
       if (key[SDLK_RETURN])
       {
                   if (CampCursorCord.y == 433)
                   {
                    if (CurrentLevel >= 5)
                    {
                    EnterApprentice = true;
                    Cursor5Cord.x = 290;
                    Cursor5Cord.y = 453;
                    campEnterKey = 2;
                    Mix_PlayChannel(2, MenuChoice, 0);
                    }
                   }
                   if (CampCursorCord.y == 467)
                   {
                      //beginner
                      EnterBeginner = true;
                      campEnterKey = 2;
                      Cursor5Cord.x = 290;
                      Cursor5Cord.y = 453;
                      Mix_PlayChannel(2, MenuChoice, 0);
                   }   
                   
        if (CampCursorCord.y == 501)
        {
        CampCursorCord.x = 278;
        CampCursorCord.y = 429;
        EnterBuyEquipment = false;
        campEnterKey = 2;
        }
       }
     }
     if (!key[SDLK_RETURN])
     {
       campEnterKey = 1;
     }
     }
}

if (EnterBeginner == true)
{
   SDL_BlitSurface (Cursor3, NULL, screen, &Cursor5Cord); 
   if (campUpKey == 1)
   {
      if (key[SDLK_UP])
      {
         if (Cursor5Cord.y > 231)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
          Cursor5Cord.y = Cursor5Cord.y - 37;
          campUpKey = 2;
         }
      }
   }
   if (!key[SDLK_UP])
   {
   campUpKey = 1;
   }
   
   if (campDownKey == 1)
   {
      if (key[SDLK_DOWN])
      {
         if (Cursor5Cord.y < 453)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
         Cursor5Cord.y = Cursor5Cord.y +37;
         campDownKey = 2;
         }
      }
   }
   if (!key[SDLK_DOWN])
   {
      campDownKey = 1;
   }
   
   if (campEnterKey == 1)
   {
     if(key[SDLK_RETURN])
     {
       if (Cursor5Cord.y == 342)
       {
         //dagger
         Price = gold - 50;
         if (Price >=0)
         {
         gold = gold - 50;
         FoundDagger++;
         campEnterKey = 2;
         Mix_PlayChannel(3, MoneySound, 0);
         }
       }
       if (Cursor5Cord.y == 379)
       {
         // rusty dagger
         Price = gold - 20;
         if (Price >=0)
         {
         gold = gold - 20;
         FoundRustyDagger++;
         campEnterKey = 2;
         Mix_PlayChannel(3, MoneySound, 0);
         }
       }
       if (Cursor5Cord.y == 416)
       {
        // Leather Set
        Price = gold - 30;
        if (Price >= 0)
        {
        gold = gold - 30;
        FoundLeather++;
        campEnterKey = 2;
        Mix_PlayChannel(3, MoneySound, 0);
        }
       }
       if (Cursor5Cord.y == 453)
       {
         EnterBeginner = false;
         campEnterKey = 2;
       }
     }
   }
   if (!key[SDLK_RETURN])
   {
    campEnterKey = 1;
   }
}

if (EnterApprentice == true)
{
   SDL_BlitSurface (Cursor3, NULL, screen, &Cursor5Cord); 
   if (campUpKey == 1)
   {
      if (key[SDLK_UP])
      {
         if (Cursor5Cord.y > 231)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
          Cursor5Cord.y = Cursor5Cord.y - 37;
          campUpKey = 2;
         }
      }
   }
   if (!key[SDLK_UP])
   {
   campUpKey = 1;
   }
   
   if (campDownKey == 1)
   {
      if (key[SDLK_DOWN])
      {
         if (Cursor5Cord.y < 453)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
         Cursor5Cord.y = Cursor5Cord.y +37;
         campDownKey = 2;
         }
      }
   }
   if (!key[SDLK_DOWN])
   {
      campDownKey = 1;
   }
   
   if (campEnterKey == 1)
   {
     if(key[SDLK_RETURN])
     {
               if (Cursor5Cord.y == 342)
       {
         // Poison Sword
         Price = gold - 250;
         if (Price >=0)
         {
         gold = gold - 250;
         FoundPoisonSword++;
         campEnterKey = 2;
         Mix_PlayChannel(3, MoneySound, 0);
         }
       }
       if (Cursor5Cord.y == 379)
       {
         // ShadowRobe
         Price = gold - 300;
         if (Price >=0)
         {
         gold = gold - 300;
         FoundShadowRobe++;
         campEnterKey = 2;
         Mix_PlayChannel(3, MoneySound, 0);
         }
       }            
        if (Cursor5Cord.y == 416)
       {
        // Rock Plate
        Price = gold - 250;
        if (Price >= 0)
        {
        gold = gold - 250;
        FoundRockPlate++;
        campEnterKey = 2;
        Mix_PlayChannel(3, MoneySound, 0);
        }
       }                  
                         
       if (Cursor5Cord.y == 453)
       {
         EnterApprentice = false;
         campEnterKey = 2;
       }
     }
   }
   if (!key[SDLK_RETURN])
   {
    campEnterKey = 1;
   }
}



if (EnterSellEquipment == true)
{
   SDL_BlitSurface (BuyEquipment, NULL, screen, &BuySellEquipmentCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);   
   SellTxt = TTF_RenderText_Solid(MinionProBold, "Sell", NormalColor);
   SDL_BlitSurface(SellTxt,NULL,screen, &SellTxt2Cord);
    if (CampCursorCord.y == 467)
    { //SELL Beginner gear 
      BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      if (FoundLeather > 0)
      {
      LeatherSetFound = TTF_RenderText_Solid(MinionPro, "Leather Set", NormalColor);
      SDL_BlitSurface(LeatherSetFound,NULL,screen, &Buy1Cord);
      LeatherPrice = TTF_RenderText_Solid(MinionPro, "15", GoldColor);
      SDL_BlitSurface(LeatherPrice,NULL,screen, &Price1Cord);

 ostringstream Leatherconvert2;
 Leatherconvert2 << FoundLeather;
 LeatherTotalTxt = Leatherconvert2.str(); 
 const char * LeatherTotalConst = LeatherTotalTxt.c_str();
 delete[] LeatherTotalConst;
 LeatherTotalImg = TTF_RenderText_Solid(MinionPro, LeatherTotalConst ,NormalColor);
 SDL_BlitSurface(LeatherTotalImg,NULL,screen,&Quan1Cord); 
      }
      if (FoundRustyDagger > 0)
      {
      RustyDaggerFound =TTF_RenderText_Solid(MinionPro, "Rusty Dagger", NormalColor);
      SDL_BlitSurface(RustyDaggerFound, NULL, screen, &Buy2Cord);
      RustyDaggerPrice = TTF_RenderText_Solid(MinionPro, "7", GoldColor);
      SDL_BlitSurface(RustyDaggerPrice,NULL,screen, &Price2Cord);
 
     ostringstream  RustyDaggerTotal2Convert;
 RustyDaggerTotal2Convert <<   FoundRustyDagger;
 RustyDaggerTotalTxt = RustyDaggerTotal2Convert.str(); 
 const char * RustyDaggerTotalConst = RustyDaggerTotalTxt.c_str();
 delete[] RustyDaggerTotalConst;
 RustyDaggerTotalImg = TTF_RenderText_Solid(MinionPro, RustyDaggerTotalConst ,NormalColor);
 SDL_BlitSurface(RustyDaggerTotalImg,NULL,screen,&Quan2Cord);  
}
      if (FoundDagger > 0)
      {
      DaggerFound =TTF_RenderText_Solid(MinionPro, "Dagger", NormalColor);
      SDL_BlitSurface(DaggerFound, NULL, screen, &Buy3Cord);
      DaggerPrice =TTF_RenderText_Solid(MinionPro, "20", GoldColor);
      SDL_BlitSurface(DaggerPrice, NULL, screen, &Price3Cord);

      ostringstream  DaggerTotal2Convert;
 DaggerTotal2Convert <<   FoundDagger;
 DaggerTotalTxt = DaggerTotal2Convert.str(); 
 const char * DaggerTotalConst = DaggerTotalTxt.c_str();
 delete[] DaggerTotalConst;
 DaggerTotalImg = TTF_RenderText_Solid(MinionPro, DaggerTotalConst ,NormalColor);
 SDL_BlitSurface(DaggerTotalImg,NULL,screen,&Quan3Cord); 
      }
      if (FoundGoberion > 0)
      {
      GoberionFound = TTF_RenderText_Solid(MinionPro, "Goberion's Set", UniqueColor);   
      SDL_BlitSurface(GoberionFound, NULL, screen, &Buy4Cord);
      GoberionPrice =TTF_RenderText_Solid(MinionPro, "50", GoldColor);
      SDL_BlitSurface(GoberionPrice, NULL, screen, &Price4Cord);
      
   ostringstream Goberion3Convert;
 Goberion3Convert << FoundGoberion;
 GoberionTotalTxt = Goberion3Convert.str(); 
 const char * GoberionTotalConst = GoberionTotalTxt.c_str();
 delete[] GoberionTotalConst;
 GoberionTotalImg = TTF_RenderText_Solid(MinionPro, GoberionTotalConst ,NormalColor);
 SDL_BlitSurface(GoberionTotalImg,NULL,screen,&Quan4Cord); 
      }
      if (FoundGoldenFang > 0)
      {
      GoldenFangFound2 = TTF_RenderText_Solid(MinionPro, "Golden Fang", UniqueColor);   
      SDL_BlitSurface(GoldenFangFound2, NULL, screen, &Buy5Cord);
      GoldenFangPrice =TTF_RenderText_Solid(MinionPro, "60", GoldColor);
      SDL_BlitSurface(GoldenFangPrice, NULL, screen, &Price5Cord);

    ostringstream  GoldenFangTotal2Convert;
 GoldenFangTotal2Convert <<   FoundGoldenFang;
 GoldenFangTotalTxt = GoldenFangTotal2Convert.str(); 
 const char * GoldenFangTotalConst = GoldenFangTotalTxt.c_str();
 delete[] GoldenFangTotalConst;
 GoldenFangTotalImg = TTF_RenderText_Solid(MinionPro, GoldenFangTotalConst ,NormalColor);
 SDL_BlitSurface(GoldenFangTotalImg,NULL,screen,&Quan5Cord); 
      }
    } 
    if (CampCursorCord.y == 433)
    { 
     if (CurrentLevel >= 5)
    {
                         // apprentice
      if (FoundQuickBlade > 0)
      {
      QuickBladeFound2 = TTF_RenderText_Solid(MinionPro, "Quick Blade", UniqueColor);   
      SDL_BlitSurface(QuickBladeFound2, NULL, screen, &Buy5Cord);
      QuickBladePrice =TTF_RenderText_Solid(MinionPro, "170", GoldColor);
      SDL_BlitSurface(QuickBladePrice, NULL, screen, &Price5Cord);
 
  ostringstream  QuickBladeTotal2Convert;
QuickBladeTotal2Convert <<   FoundQuickBlade;
 QuickBladeTotalTxt = QuickBladeTotal2Convert.str(); 
 const char * QuickBladeTotalConst = QuickBladeTotalTxt.c_str();
 delete[] QuickBladeTotalConst;
 QuickBladeTotalImg = TTF_RenderText_Solid(MinionPro, QuickBladeTotalConst ,NormalColor);
 SDL_BlitSurface(QuickBladeTotalImg,NULL,screen,&Quan5Cord); 
      }
      if ( FoundRockiansPlate > 0)
      {
      RockiansPlateFound = TTF_RenderText_Solid(MinionPro, "Rockians Plate", UniqueColor);   
      SDL_BlitSurface(RockiansPlateFound, NULL, screen, &Buy4Cord);
      RockiansPlatePrice =TTF_RenderText_Solid(MinionPro, "150", GoldColor);
      SDL_BlitSurface(RockiansPlatePrice, NULL, screen, &Price4Cord);
      
      ostringstream RockianPlateTotal2Convert;
 RockianPlateTotal2Convert <<  FoundRockiansPlate;
 RockianPlateTotalTxt = RockianPlateTotal2Convert.str(); 
 const char * RockianPlateTotalConst = RockianPlateTotalTxt.c_str();
 delete[] RockianPlateTotalConst;
 RockianPlateTotalImg = TTF_RenderText_Solid(MinionPro, RockianPlateTotalConst ,NormalColor);
 SDL_BlitSurface(RockianPlateTotalImg,NULL,screen,&Quan4Cord);  
      }
     if (FoundPoisonSword > 0 )
     {
     PoisonSwordFound =TTF_RenderText_Solid(MinionPro, "Poison Sword", NormalColor);
     SDL_BlitSurface(PoisonSwordFound, NULL, screen, &Buy3Cord);
      PoisonSwordPrice =TTF_RenderText_Solid(MinionPro, "70", GoldColor);
      SDL_BlitSurface(PoisonSwordPrice, NULL, screen, &Price3Cord);
      
     ostringstream  PoisonSwordTotal2Convert;
 PoisonSwordTotal2Convert <<   FoundPoisonSword;
 PoisonSwordTotalTxt = PoisonSwordTotal2Convert.str(); 
 const char * PoisonSwordTotalConst = PoisonSwordTotalTxt.c_str();
 delete[] PoisonSwordTotalConst;
 PoisonSwordTotalImg = TTF_RenderText_Solid(MinionPro, PoisonSwordTotalConst ,NormalColor);
 SDL_BlitSurface(PoisonSwordTotalImg,NULL,screen,&Quan3Cord); 
      }
      if (FoundShadowRobe > 0)
      {
     ShadowRobeFound =TTF_RenderText_Solid(MinionPro, "Shadow Robe", NormalColor);
     SDL_BlitSurface(ShadowRobeFound, NULL, screen, &Buy2Cord);
     ShadowRobePrice =TTF_RenderText_Solid(MinionPro, "100", GoldColor);
      SDL_BlitSurface(ShadowRobePrice, NULL, screen, &Price2Cord);
      
      ostringstream  ShadowRobeTotal2Convert;
 ShadowRobeTotal2Convert <<   FoundShadowRobe;
 ShadowRobeTotalTxt = ShadowRobeTotal2Convert.str(); 
 const char * ShadowRobeTotalConst = ShadowRobeTotalTxt.c_str();
 delete[] ShadowRobeTotalConst;
 ShadowRobeTotalImg = TTF_RenderText_Solid(MinionPro, ShadowRobeTotalConst ,NormalColor);
 SDL_BlitSurface(ShadowRobeTotalImg,NULL,screen,&Quan2Cord);  
      }
      if (FoundRockPlate > 0)
      {
     RockPlateFound =TTF_RenderText_Solid(MinionPro, "Rock Plate", NormalColor);
     SDL_BlitSurface(RockPlateFound, NULL, screen, &Buy1Cord);
          RockPlatePrice =TTF_RenderText_Solid(MinionPro, "70", GoldColor);
      SDL_BlitSurface(RockPlatePrice, NULL, screen, &Price1Cord);  
 
    ostringstream RockPlateTotal2Convert;
 RockPlateTotal2Convert << FoundRockPlate;
 RockPlateTotalTxt = RockPlateTotal2Convert.str(); 
 const char * RockPlateTotalConst = RockPlateTotalTxt.c_str();
 delete[] RockPlateTotalConst;
 RockPlateTotalImg = TTF_RenderText_Solid(MinionPro, RockPlateTotalConst ,NormalColor);
 SDL_BlitSurface(RockPlateTotalImg,NULL,screen,&Quan1Cord);     
      }
     
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
     SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
     if (CurrentLevel < 5)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
    }
    }
    
    
      if (CampCursorCord.y == 399)
    {
    if (CurrentLevel >= 15)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 15)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
    if (CampCursorCord.y == 365)
    {
    if (CurrentLevel >=20)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
    }
         if (CurrentLevel < 20)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
   }

    if (CampCursorCord.y == 331)
    {
        if (CurrentLevel >=25)
    {
    BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 25)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
    if (CampCursorCord.y == 297)
    {
      if (CurrentLevel >=30)
      {
        BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
        SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 30)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    if (CampCursorCord.y == 263)
    {
    if (CurrentLevel >= 35)
    {
     BackTxt = TTF_RenderText_Solid(MinionProBold, "Back", NormalColor);   
      SDL_BlitSurface(BackTxt, NULL, screen, &BackTxtCord);
      }
      if (CurrentLevel < 35)
     {
     TooLowTxt = TTF_RenderText_Solid(MinionProBold, "Too low level.", BossColor);   
     SDL_BlitSurface(TooLowTxt, NULL, screen, &TooLowCord);
     }
    }
    
    
   if ((SellBeginner == false) && (SellApprentice == false))
   {
     if (campUpKey == 1)
     {
       if (key[SDLK_UP])
       {
          if (CampCursorCord.y > 263)
          {
           Mix_PlayChannel(2, MenuChoice, 0);
          CampCursorCord.y = CampCursorCord.y - 34;
          campUpKey = 2;
          }
       }
     }
     if (!key[SDLK_UP])
     {
       campUpKey = 1;
     }
     if (campDownKey == 1)
     {
        if (key[SDLK_DOWN])
        {
           if (CampCursorCord.y < 501)
           {
            Mix_PlayChannel(2, MenuChoice, 0);
           CampCursorCord.y = CampCursorCord.y + 34;
           campDownKey = 2;
           }
        }
     }
     if (!key[SDLK_DOWN])
     {
      campDownKey = 1;
     }
     
        if (campEnterKey == 1)
     {
       if (key[SDLK_RETURN])
       {
                            if (CampCursorCord.y == 433)
                   {
                    if (CurrentLevel >= 5)
                    {
                    SellApprentice = true;
                    Cursor5Cord.x = 290;
                    Cursor5Cord.y = 453;
                    campEnterKey = 2;
                    Mix_PlayChannel(2, MenuChoice, 0);
                    }
                   }
                   if (CampCursorCord.y == 467)
                   {
                      //sell beginner
                      SellBeginner = true;
                      campEnterKey = 2;
                      Cursor5Cord.x = 290;
                      Cursor5Cord.y = 453;
                      Mix_PlayChannel(2, MenuChoice, 0);
                   }   
                   
         if (CampCursorCord.y == 501)
         {
         CampCursorCord.x = 278;
         CampCursorCord.y = 429;
         EnterSellEquipment = false;
         campEnterKey = 2;
         }
       }
     }
     if (!key[SDLK_RETURN])
     {
       campEnterKey = 1;
     }       
     }        
}

if (SellBeginner == true)
{
 SDL_BlitSurface (Cursor3, NULL, screen, &Cursor5Cord); 
   if (campUpKey == 1)
   {
      if (key[SDLK_UP])
      {
         if (Cursor5Cord.y > 231)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
          Cursor5Cord.y = Cursor5Cord.y - 37;
          campUpKey = 2;
         }
      }
   }
   if (!key[SDLK_UP])
   {
   campUpKey = 1;
   }
   
   if (campDownKey == 1)
   {
      if (key[SDLK_DOWN])
      {
         if (Cursor5Cord.y < 453)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
         Cursor5Cord.y = Cursor5Cord.y +37;
         campDownKey = 2;
         }
      }
   }
   if (!key[SDLK_DOWN])
   {
      campDownKey = 1;
   }
   
   if (campEnterKey == 1)
   {
     if(key[SDLK_RETURN])
     {
         if (Cursor5Cord.y == 268)
         {
           if (FoundGoldenFang > 0)
           {
             if ((EquipGoldenFang == true) || (FoundGoldenFang > 1))
             {
               gold = gold + 60;
               FoundGoldenFang--;
               campEnterKey = 2;
               Mix_PlayChannel(3, MoneySound, 0);
             }
           }
         }
         if (Cursor5Cord.y == 305)
         {
           if (FoundGoberion > 0)
           {
             if ((EquipGoberion == true) || (FoundGoberion > 1))
             {
                gold = gold + 50;
                FoundGoberion--;
                campEnterKey = 2;
                Mix_PlayChannel(3, MoneySound, 0);
             }     
            }
         }
         if (Cursor5Cord.y == 342)
         {
         //dagger
         if (FoundDagger > 0)
        {
        if ((EquipDagger == true) || (FoundDagger > 1))
        {
          gold = gold + 20;
          FoundDagger--;
          campEnterKey = 2;
          Mix_PlayChannel(3, MoneySound, 0);
        }
        }
       }
       if (Cursor5Cord.y == 379)
       {
         // rusty dagger
         if (FoundRustyDagger > 0)
        {
          if ((EquipRustyDagger == true) || (FoundRustyDagger > 1))
          {
           gold = gold + 7;
           FoundRustyDagger--;
           campEnterKey = 2;
          Mix_PlayChannel(3, MoneySound, 0);
          }
        }
       }
       if (Cursor5Cord.y == 416)
       {
        // Leather Set
        if (FoundLeather > 0)
        {
          if ((EquipLeather == true) || (FoundLeather > 1))
          {
            gold = gold + 15;
            FoundLeather--;
            campEnterKey = 2;
            Mix_PlayChannel(3, MoneySound, 0);
          }
        }
       }
       if (Cursor5Cord.y == 453)
       {
       SellBeginner = false;
       campEnterKey = 2;
       }
     }
   }
   if (!key[SDLK_RETURN])
   {
     campEnterKey = 1;
   }
   
}

if (SellApprentice == true)
{
 SDL_BlitSurface (Cursor3, NULL, screen, &Cursor5Cord); 
   if (campUpKey == 1)
   {
      if (key[SDLK_UP])
      {
         if (Cursor5Cord.y > 231)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
          Cursor5Cord.y = Cursor5Cord.y - 37;
          campUpKey = 2;
         }
      }
   }
   if (!key[SDLK_UP])
   {
   campUpKey = 1;
   }
   
   if (campDownKey == 1)
   {
      if (key[SDLK_DOWN])
      {
         if (Cursor5Cord.y < 453)
         {
          Mix_PlayChannel(2, MenuChoice, 0);
         Cursor5Cord.y = Cursor5Cord.y +37;
         campDownKey = 2;
         }
      }
   }
   if (!key[SDLK_DOWN])
   {
      campDownKey = 1;
   }
   
   if (campEnterKey == 1)
   {
     if(key[SDLK_RETURN])
     {
          if (Cursor5Cord.y == 268)
         {
           if (FoundQuickBlade > 0)
           {
             if ((EquipQuickBlade == true) || (FoundQuickBlade > 1))
             {
               gold = gold + 170;
               FoundQuickBlade--;
               campEnterKey = 2;
               Mix_PlayChannel(3, MoneySound, 0);
             }
           }
         }
         if (Cursor5Cord.y == 305)
         {
           if (FoundRockiansPlate > 0)
           {
             if ((EquipRockianPlate == true) || (FoundRockiansPlate > 1))
             {
                gold = gold + 150;
                FoundRockiansPlate--;
                campEnterKey = 2;
                Mix_PlayChannel(3, MoneySound, 0);
             }     
            }
         }
       
        if (Cursor5Cord.y == 342)
       {
         //dagger
         if (FoundPoisonSword > 0)
        {
        if ((EquipPoisonSword == true) || (FoundPoisonSword > 1))
        {
        gold = gold + 70;
        FoundPoisonSword--;
        campEnterKey = 2;
        Mix_PlayChannel(3, MoneySound, 0);
        }
        }
       }
       if (Cursor5Cord.y == 379)
       {
         //shadow robe
         if (FoundShadowRobe > 0)
        {
        if ((EquipShadowRobe == true) || (FoundShadowRobe > 1))
        {
        gold = gold + 100;
        FoundShadowRobe--;
        campEnterKey = 2;
        Mix_PlayChannel(3, MoneySound, 0);
        }
        }
       }
       if (Cursor5Cord.y == 416)
       {
        // Leather Set
        if (FoundRockPlate > 0)
        {
          if ((EquipRockPlate == true) || (FoundRockPlate > 1))
          {
          gold = gold + 70;
          FoundRockPlate--;
          campEnterKey = 2;
          Mix_PlayChannel(3, MoneySound, 0);
          }
        }
       }
       
       if (Cursor5Cord.y == 453)
       {
       SellApprentice = false;
       campEnterKey = 2;
       }
     }
   }
   if (!key[SDLK_RETURN])
   {
     campEnterKey = 1;
   }
}

if (MapMenuOpen == true)
{
 SDL_BlitSurface (ChoiceMap, NULL, screen, &ChoiceMapCord);
   SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord); 
   
     GoblinForest = TTF_RenderText_Solid(MinionPro, "Goblin Forest", NormalColor);
           SDL_BlitSurface(GoblinForest, NULL, screen, &GoblinForestCord);
     RockCave = TTF_RenderText_Solid(MinionPro, "Rock Cave", NormalColor);
           SDL_BlitSurface(RockCave, NULL, screen, &RockCaveCord);
           
   if (campUpKey == 1)
   {
     if (key[SDLK_UP])
     {
        if (CampCursorCord.y != 269)
        {
        Mix_PlayChannel(2, MenuChoice, 0);
        CampCursorCord.y = CampCursorCord.y - 39;
        campUpKey = 2;
        }
     } 
   }
   if (!key[SDLK_UP])
   {
      campUpKey = 1;
   }
   
   if (campDownKey == 1)
   {
     if (key[SDLK_DOWN])
     {
        if (CampCursorCord.y != 542)
        {
        Mix_PlayChannel(2, MenuChoice, 0);
        CampCursorCord.y = CampCursorCord.y + 39;
        campDownKey = 2;
        }
     } 
   }
   if (!key[SDLK_DOWN])
   {
      campDownKey = 1;
   }
   
    if (campEnterKey == 1)
    {
      if (key[SDLK_RETURN])
      {
        if (CampCursorCord.y == 542)
        {
           Mix_PlayChannel(2, MenuChoice, 0);
           CampCursorCord.y = 388;
           MapMenuOpen = false;
           campEnterKey = 2; 
        }
        if (CampCursorCord.y == 503)
        {
        CampCursorCord.x = 33;
        CampCursorCord.y = 387;
        StopCampM = true;
        campEnterKey = 2;     
        MapMenuOpen = false;     
        ActiveBattle = true;
        GoblinForestMap = true;
        }
        if (CampCursorCord.y == 464)
        {
        CampCursorCord.x = 33;
        CampCursorCord.y = 387;
        StopCampM = true;
        campEnterKey = 2;     
        MapMenuOpen = false;     
        ActiveBattle = true;
        RockCaveMap = true;
        
        }
      }
    }
    if (!key[SDLK_RETURN])
    {
      campEnterKey = 1;
    }
}


if (CharacterStatsMenuOpen == false) 
{
if (EquipmentMenuOpen == false) 
{
   if (CharacterMenuOpen == true)
   {
       SDL_BlitSurface (CharacterMenu, NULL, screen, &CampExitCord);
       SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);  
           if (key[SDLK_DOWN])
       {
           if (campDownKey == 1)
        {
          if (CampCursorCord.y != 494)
          {
             CampCursorCord.y = CampCursorCord.y + 39;
             campDownKey = 2;
               Mix_PlayChannel(2, MenuChoice, 0);
          }  
          }
          }
       if (!key[SDLK_DOWN])
       {
           campDownKey = 1;
       }
       
           if (key[SDLK_UP])
       {
       if (campUpKey == 1)
        {
          if (CampCursorCord.y != 416)
          {
             CampCursorCord.y = CampCursorCord.y - 39;
             campUpKey = 2;
               Mix_PlayChannel(2, MenuChoice, 0);
          }  
          }
          }
       if (!key[SDLK_UP])
       {
           campUpKey = 1;
       }
       
       if (key[SDLK_RETURN])
       {
             if (campEnterKey == 1)
             {   
                  if (CampCursorCord.y == 416)
                  {
                  //Character Stats
                  CharacterStatsMenuOpen = true;
                  Mix_PlayChannel(2, MenuChoice, 0);
                  CampCursorCord.y = 524;
                  CampCursorCord.x = 255; // 278
                  campEnterKey = 2;
                  }
                  if (CampCursorCord.y == 455)
                  {
                  //Equipment
                  EquipmentMenuOpen = true;
                  Mix_PlayChannel(2, MenuChoice, 0);
                  Cursor2Cord.y = 530;
                  Cursor2Cord.x = 178;
                  campEnterKey = 2;
                  }
                  if ( CampCursorCord.y == 494)
                  {
                  //Back
                  CampCursorCord.y = 427;
                  CharacterMenuOpen = false;
                  Mix_PlayChannel(2, MenuChoice, 0);
                  campEnterKey = 2;
                  }
             }
       }
       if (!key[SDLK_RETURN])
       {
             campEnterKey = 1;
       }
   }
}
}

if (CharacterStatsMenuOpen == true)
{
       SDL_BlitSurface (CharacterStatsMenu, NULL, screen, &CharacterStatsCord);
       SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
       DrawStats();
       if (campEnterKey == 1)
       {
         if (key[SDLK_RETURN]) 
         {
             if ( (CampCursorCord.y = 535)  & (CampCursorCord.x = 255) )
             {
             Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = 416;
             CampCursorCord.x = 278;
             CharacterStatsMenuOpen = false;
             campEnterKey = 2;
             }
         }
       }
       if (!key[SDLK_RETURN])
       {
             campEnterKey = 1;
       }
}

if (EquipmentMenuOpen == true)
{  
       SDL_BlitSurface (EquipmentMenu, NULL, screen, &EquipmentMenuCord);
       SDL_BlitSurface (Cursor2, NULL, screen, &Cursor2Cord);
       DrawGear();
       DrawWeapons();
       CheckGear();
       CheckWeapons();
        
       if ((ArmorMenuOpen == false) & (WeaponMenuOpen == false))
       {
       //right
       if (campRightKey == 1) 
          {
            if (key[SDLK_RIGHT])
             {
                if ( Cursor2Cord.x != 340)
                {
                 Mix_PlayChannel(2, MenuChoice, 0);
                Cursor2Cord.x = Cursor2Cord.x + 162;
                campRightKey = 2;
                }
             }
          }
          
          if (!key[SDLK_RIGHT])
          {
              campRightKey = 1;
          }
          //left
          if (campLeftKey == 1)
          {
             if (key[SDLK_LEFT]) 
             {
                 if (Cursor2Cord.x != 16)
                 {
                  Mix_PlayChannel(2, MenuChoice, 0);
                 Cursor2Cord.x = Cursor2Cord.x - 162;
                 campLeftKey = 2;
                 }
             }
          }
          
          if (!key[SDLK_LEFT])
          {
             campLeftKey = 1;
          }
       
       if (campEnterKey == 1)
       {
         if (key[SDLK_RETURN]) 
         {
             if(Cursor2Cord.x == 178)
             {
             //back
             Mix_PlayChannel(2, MenuChoice, 0);
             CampCursorCord.y = 455;
             CampCursorCord.x = 278;
             EquipmentMenuOpen = false;
             campEnterKey = 2;
             }
             if(Cursor2Cord.x == 16)
             {
              //armor
              ArmorMenuOpen = true;
              Mix_PlayChannel(2, MenuChoice, 0);
              campEnterKey = 2;
              
             }
             if(Cursor2Cord.x == 340)
             {
              //weapon
              WeaponMenuOpen = true;
              Mix_PlayChannel(2, MenuChoice, 0);
              campEnterKey = 2;
             }
         }
       }
       if (!key[SDLK_RETURN])
       {
             campEnterKey = 1;
       }
   }
}

if (WeaponMenuOpen == true)
{
    SDL_BlitSurface (Cursor3, NULL, screen, &Cursor4Cord);
    //down
    if (campDownKey == 1)
    {
      if (key[SDLK_DOWN])
      {
         if (Cursor4Cord.y != 467)
         {
         Cursor4Cord.y = Cursor4Cord.y + 37;
         campDownKey = 2;
          CheckWeaponUnequip();
         }
      }
    }
    if (!key[SDLK_DOWN])
    {
       campDownKey = 1;
    }
    // up
     if (campUpKey == 1)
    {
      if (key[SDLK_UP])
      {
         if (Cursor4Cord.y != 171)
         {
         Cursor4Cord.y = Cursor4Cord.y - 37;
         campUpKey = 2;
          CheckWeaponUnequip();
         }
      }
    }
    if (!key[SDLK_UP])
    {
       campUpKey = 1;
    }
    
       // right
     if (campRightKey == 1)
    {
      if (key[SDLK_RIGHT])
      {
         if (Cursor4Cord.x != 277) //30
         {
         Cursor4Cord.x = Cursor4Cord.x + 247;
         campRightKey = 2;
          CheckWeaponUnequip();
         }
      }
    }
    if (!key[SDLK_RIGHT])
    {
       campRightKey = 1;
    }
    
       // left
     if (campLeftKey == 1)
    {
      if (key[SDLK_LEFT])
      {
         if (Cursor4Cord.x != 30) //30
         {
         Cursor4Cord.x = Cursor4Cord.x - 247;
         campLeftKey = 2;
          CheckWeaponUnequip();
         }
      }
    }
    if (!key[SDLK_LEFT])
    {
       campLeftKey = 1;
    }
    
    
    if (campEnterKey == 1)
    {
     if (key[SDLK_RETURN])
     {
        WeaponMenuOpen = false;
        campEnterKey = 2;
     }
    }
    if (!key[SDLK_RETURN])
    {
       campEnterKey = 1;
    }

}

if (ArmorMenuOpen == true)
{
    SDL_BlitSurface (Cursor3, NULL, screen, &Cursor3Cord);
    //down
    if (campDownKey == 1)
    {
      if (key[SDLK_DOWN])
      {
         if (Cursor3Cord.y != 467)
         {
         Cursor3Cord.y = Cursor3Cord.y + 37;
         campDownKey = 2;
          CheckGearUnequip();
         }
      }
    }
    if (!key[SDLK_DOWN])
    {
       campDownKey = 1;
    }
    // up
     if (campUpKey == 1)
    {
      if (key[SDLK_UP])
      {
         if (Cursor3Cord.y != 171)
         {
         Cursor3Cord.y = Cursor3Cord.y - 37;
         campUpKey = 2;
          CheckGearUnequip();
         }
      }
    }
    if (!key[SDLK_UP])
    {
       campUpKey = 1;
    }
    
       // right
     if (campRightKey == 1)
    {
      if (key[SDLK_RIGHT])
      {
         if (Cursor3Cord.x != 277) //30
         {
         Cursor3Cord.x = Cursor3Cord.x + 247;
         campRightKey = 2;
             CheckGearUnequip();
         }
      }
    }
    if (!key[SDLK_RIGHT])
    {
       campRightKey = 1;
    }
    
       // left
     if (campLeftKey == 1)
    {
      if (key[SDLK_LEFT])
      {
         if (Cursor3Cord.x != 30) //30
         {
         Cursor3Cord.x = Cursor3Cord.x - 247;
         campLeftKey = 2;
         CheckGearUnequip();
         }
      }
    }
    if (!key[SDLK_LEFT])
    {
       campLeftKey = 1;
    }
    
    
    if (campEnterKey == 1)
    {
     if (key[SDLK_RETURN])
     {
        ArmorMenuOpen = false;
        campEnterKey = 2;
     }
    }
    if (!key[SDLK_RETURN])
    {
       campEnterKey = 1;
    }
}

   if(menu == 2)
      {
       SDL_BlitSurface (CampExit, NULL, screen, &CampExitCord);
       SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
       if (campUpKey == 1)
       {
       if (key[SDLK_UP])
       {
           if (CampCursorCord.y == 495)  
           {
                 Mix_PlayChannel(2, MenuChoice, 0);
              CampCursorCord.y = CampCursorCord.y-48;  
           }      
           campUpKey = 2;   
       }
       }
       if (!key[SDLK_UP])
       {
           campUpKey = 1;
       }
       if (campDownKey == 1)
       {
       if (key[SDLK_DOWN])
       {
           if (CampCursorCord.y == 447)
           {
               Mix_PlayChannel(2, MenuChoice, 0);
           CampCursorCord.y = CampCursorCord.y+48; 
           }        
           campDownKey = 2;     
       }
       }
       if (!key[SDLK_DOWN])
       {
         campDownKey = 1;                   
       }
       if (campEnterKey == 1)
       {
       if (key[SDLK_RETURN])
       {
           
           if (CampCursorCord.y == 495)  
           {
                        Mix_PlayChannel(2, MenuChoice, 0);
               campEnterKey = 2;
               CampCursorCord.y = 544;
               menu = 1;
              
           }          
           if (CampCursorCord.y == 447)
           {
                    Mix_PlayChannel(2, MenuChoice, 0);
               campEnterKey = 2;
               CleanData();
               return 0;
           }
           
       }
   }
          if (!key[SDLK_RETURN])
         {
            campEnterKey = 1;
         }
          
}
   
      if (Battle == true)
       {
             if ( StopGame == false)
             {
                   
             Player.flee();
             Player.attack();
             DeathAnimation();
             Enemy1.EnemyAttack();
             if(LifeBarCrop.w <= 87)
             {
                LifeBarCrop.w = 87;
                PlayerDeath = false;
                 StopGame = true;
             }
             
             if (abilitiesButton == true)
{
    SDL_BlitSurface (AbilitiesMenu, NULL, screen, &BattleMenuCord);
    SDL_BlitSurface (CampCursor, NULL, screen, &CampCursorCord);
    if (UnlockQuickSlash == true)
    {
          QuickSlashAbi =TTF_RenderText_Solid(MinionProBold, "Quick Slash 10", BossColor);
          SDL_BlitSurface(QuickSlashAbi, NULL, screen, &FirstAbiCord);
    }
    if (UnlockHighJump == true)
    {
          HighJumpAbi =TTF_RenderText_Solid(MinionProBold, "High Jump 15", BossColor);
          SDL_BlitSurface(HighJumpAbi, NULL, screen, &SecondAbiCord);
   }
    if (campDownKey == 1)
    {
     if (key[SDLK_DOWN])
     {
       if (CampCursorCord.y != 522)
       {
           Mix_PlayChannel(2, MenuChoice, 0);
           CampCursorCord.y = CampCursorCord.y + 39;
       }
       campDownKey = 2;
     }
    }
    if (!key[SDLK_DOWN])
    {
    campDownKey = 1;
    }
    if (campUpKey == 1)
    {
    if (key[SDLK_UP])
    {
        if (CampCursorCord.y != 405) 
        {   
        Mix_PlayChannel(2, MenuChoice, 0);       
        CampCursorCord.y = CampCursorCord.y - 39;
        }
            campUpKey = 2;
    }
}
    if (!key[SDLK_UP])
    {
       campUpKey = 1;
    }
    
    if (campEnterKey == 1)
    {
       if (key[SDLK_RETURN])
       {
          if (CampCursorCord.y == 522) 
          {
             Mix_PlayChannel(2, MenuChoice, 0);
             abilitiesButton = false;
             CampCursorCord.y = 426;
             campEnterKey = 2;
          }
     if ((WaitBar2Crop.w == 210) && (SP >= 10))
     { 
       if ((CampCursorCord.y == 483)  && (UnlockQuickSlash == true))
          {
             Mix_PlayChannel(2, MenuChoice, 0);
             abilitiesAttack1 = true;
             Abilities = true; 
             abilitiesButton = false;
             campEnterKey = 2;
             SP = SP - 10;
             
          }
       }
       if ((WaitBar2Crop.w == 210) && (SP>= 15))
       {
         if ((CampCursorCord.y == 444) && (UnlockHighJump == true))
         {
            Mix_PlayChannel(2, MenuChoice, 0);
            abilitiesAttack2 = true;
            Abilities = true; 
            abilitiesButton = false;
            SP = SP - 15;
            campEnterKey = 2;
         }
       }
       }
       }
    
    if (!key[SDLK_RETURN])
    {
    campEnterKey = 1;
    }
}

             
              if (abilitiesButton == false)
           {
                 
           if (campDownKey == 1)
           {
           if (key[SDLK_DOWN])
           {
                if (CampCursorCord.y != 504)
                {
                       Mix_PlayChannel(2, MenuChoice, 0);
                CampCursorCord.y = CampCursorCord.y + 39;
                }  
                campDownKey = 2;
           }
           }
            if (!key[SDLK_DOWN])
            {
                campDownKey = 1;
            }
           if (campUpKey == 1)
           { 
           if (key[SDLK_UP])
           {
                if (CampCursorCord.y != 387) 
                {   
                  Mix_PlayChannel(2, MenuChoice, 0);       
                CampCursorCord.y = CampCursorCord.y - 39;
                }
                campUpKey = 2;
           }
           }
           if (!key[SDLK_UP])
           {
               campUpKey = 1;
           }
           if (campEnterKey == 1)
           {
           if (key[SDLK_RETURN])
           {
                if (CampCursorCord.y == 387) 
                {
                       if (WaitBar2Crop.w == 210)
                        {
                               Mix_PlayChannel(2, MenuChoice, 0);
                          attackButton = true;
                          }
                          campEnterKey = 2;
                }
                if (CampCursorCord.y == 426)
                {
                   if (EnemyLifeCrop.w > 78)
                   {
                          Mix_PlayChannel(2, MenuChoice, 0);
                       //abilities
                       abilitiesButton = true;
                       CampCursorCord.y = 522;
                       campEnterKey = 2; 
                   }
                }
                if (CampCursorCord.y == 465)
                {
                          Mix_PlayChannel(2, MenuChoice, 0);
                       //items
                       campEnterKey = 2;
                }
                if (CampCursorCord.y == 504)
                {
                       if (WaitBar2Crop.w == 210)
                       {
                          Mix_PlayChannel(2, MenuChoice, 0);
                       fleeButton = true;
                       }
                       campEnterKey = 2;
                }
           }
           }
           if (!key[SDLK_RETURN])
           {
              campEnterKey = 1;
           }
           }
       }
       }
}

void ActiveBattleFunc()
{
     if (ActiveBattle == true)
     {
         //  Mix_PauseMusic();
          Battle = true;
          ActiveBattle = false;
     }
}

"It's okay. My state machine just uses code instead of memory." cool.png

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This is gonna be hard to beat, but look at my first games Menu.h file tongue.png This was written about 3 years ago as well tongue.png The funny part, game works perfectly fine here is a video of it

That's not terrible, I have (many times) seen worse stuff, written by supposed professionals...

I see it as very bad. It used to be about getting something working, now it's about getting something working in optimized way hehe :)

I can't really imagine anything worse tho. What could they do, What can be worse then having 3000 if statements in one file .h file under one function?

...Memory Leaks?

This is gonna be hard to beat, but look at my first games Menu.h file tongue.png This was written about 3 years ago as well tongue.png The funny part, game works perfectly fine here is a video of it

That's not terrible, I have (many times) seen worse stuff, written by supposed professionals...

There is worse out there, but it's still terrible. ;)


If I would write it right now, I would make field on board as its own class. That way, in main code I can simply hold a list of fields and manipulate with it, instead of... doing... what I did.

Been there, done that... share your pain, and shame. Just when I thought programming was about handling each case individually with a series of Ifs :)

This topic is closed to new replies.

Advertisement