Jump to content

  • Log In with Google      Sign In   
  • Create Account


Games by younger me

  • You cannot reply to this topic
15 replies to this topic

#1 Aurioch   Crossbones+   -  Reputation: 1296

Like
8Likes
Like

Posted 30 June 2013 - 09:09 AM

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

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.


Edited by Aurioch, 30 June 2013 - 09:10 AM.


Sponsor:

#2 slicer4ever   Crossbones+   -  Reputation: 3498

Like
0Likes
Like

Posted 30 June 2013 - 09:29 AM

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.


Edited by slicer4ever, 30 June 2013 - 09:33 AM.

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

#3 Aurioch   Crossbones+   -  Reputation: 1296

Like
0Likes
Like

Posted 30 June 2013 - 09:40 AM

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.


Edited by Aurioch, 30 June 2013 - 09:53 AM.


#4 Arthur Souza   Members   -  Reputation: 1418

Like
4Likes
Like

Posted 30 June 2013 - 11:37 PM

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


A.

Lotus - Action RPG In development http://www.gamedev.n...die-rpg-engine/ |
Personal blog In Portuguese: lotuzgames.wordpress.com |


#5 Konrad Jablonski   Members   -  Reputation: 483

Like
3Likes
Like

Posted 01 July 2013 - 12:36 PM

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 http://www.youtube.com/watch?v=4y-5io98vys

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



#6 Bacterius   Crossbones+   -  Reputation: 8532

Like
1Likes
Like

Posted 01 July 2013 - 04:52 PM

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


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#7 wack   Members   -  Reputation: 1286

Like
1Likes
Like

Posted 02 July 2013 - 05:55 PM

 

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 http://www.youtube.com/watch?v=4y-5io98vys

 

 

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



#8 Konrad Jablonski   Members   -  Reputation: 483

Like
0Likes
Like

Posted 02 July 2013 - 07:28 PM

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?



#9 LennyLen   Crossbones+   -  Reputation: 3730

Like
0Likes
Like

Posted 03 July 2013 - 08:25 PM

 

 

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 http://www.youtube.com/watch?v=4y-5io98vys

 

 

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. ;)



#10 Orymus3   Crossbones+   -  Reputation: 7668

Like
0Likes
Like

Posted 05 July 2013 - 01:33 PM


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 :)



#11 Aurioch   Crossbones+   -  Reputation: 1296

Like
0Likes
Like

Posted 05 July 2013 - 02:34 PM

Phew, weekend started, now I finally have time to be here a little XD

 

@Konrad Jablonski

Wow, game looks nice. As for the code... at least it's readable XD Now, if you would want to make one change, would you be able to do it without breaking whole thing? XXDD

 

@Arthur Souza

Thanks... I guess XD Wrote first thing which came to my mind, and LotR ended up being that...

 

@Orymus3

People learn whole life ^^ Luckily, I improved my code writing... curently I have about 30 classes of my own all communicating with other objects and/or inheriting other classes - something younger me wouldn't even think about doing.

 

What's even more embarrasing is that instead of using Rectangle to represent each board field and just use Rectangle.Contains(Point) method, I invented hot water. >.<



#12 Konrad Jablonski   Members   -  Reputation: 483

Like
0Likes
Like

Posted 05 July 2013 - 06:42 PM

Phew, weekend started, now I finally have time to be here a little XD

 

@Konrad Jablonski

Wow, game looks nice. As for the code... at least it's readable XD Now, if you would want to make one change, would you be able to do it without breaking whole thing? XXDD

 

Well probably not, I haven't touched this code in over 3 years. Now I would use classes and functions for this like any normal person :)



#13 burnt_casadilla   Members   -  Reputation: 440

Like
0Likes
Like

Posted 06 July 2013 - 04:55 AM

When I started XNA, I used to load files whenever I needed them. I recently found my first pong game and I had Content.Load lines all over the place. The nice thing about XNA is that it still worked!! But with a bigger project you  probably don't want Content.Load in the Update or Draw method -.-


If you see a post from me, you can safely assume its C# and XNA :)


#14 lithos   Members   -  Reputation: 413

Like
0Likes
Like

Posted 21 July 2013 - 07:42 PM

I made multi threaded code without even knowing I was doing it before...  that was many years ago.



#15 Sik_the_hedgehog   Crossbones+   -  Reputation: 1608

Like
0Likes
Like

Posted 21 July 2013 - 10:02 PM

That reminds me of how I still tend to avoid multithreading like the plague as if I had never used it... even after making a whole sound driver that has to cope with two completely different processors without any proper way to do handshake and the most atomic operation I can get is reading or writing a byte in RAM (I don't even get multibyte values!), which must be like the worst of the worst when it comes to multithreading =P

 

The only time I did it on PC (that didn't involve other library doing it for me - the one I mentioned before was not on PC) was recently in my game for the loading screen (otherwise the game can hang without pumping any events, which can make the OS think it got stuck and try to kill it). Given what I said above, I guess it shouldn't be surprising that it worked on the first try (even if it was quite simplistic).


Edited by Sik_the_hedgehog, 21 July 2013 - 10:03 PM.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

#16 Aurioch   Crossbones+   -  Reputation: 1296

Like
0Likes
Like

Posted 22 July 2013 - 04:15 AM

Goodie goodie, look what I found on my old PC from 1991 biggrin.png

Few years ago, I was bored on vacation and all other electronic devices were used by other family members, so I wrote this little gem in QBasic which needs serious refactoring:

CLS

DIM a, b, i, n, s AS INTEGER
DIM button AS STRING
DIM direction AS STRING
DIM x(100) AS INTEGER
DIM y(100) AS INTEGER

s = 0
n = 1
direction = ""
x(1) = 12 '25 max
y(1) = 40 '80 max
RANDOMIZE 1
a = INT(RND * 20) + 3
b = INT(RND * 77) + 2

COLOR 9
PRINT "Welcome to Aurioch's ASCII Snake"
COLOR 3
PRINT CHR$(201); STRING$(78, 205); CHR$(187)
FOR i = 1 TO 20
  PRINT CHR$(186); STRING$(78, " "); CHR$(186)
NEXT i
PRINT CHR$(200); STRING$(78, 205); CHR$(188)
LOCATE 1, 60
COLOR 12
PRINT "Score:"; S

DO
  FOR i = 1 TO n
    LOCATE x(i), y(i)
    COLOR 10
    IF i = 1 THEN
      PRINT CHR$(2)
    ELSE
      PRINT CHR$(254)
    END IF
  NEXT i

  LOCATE a, b
  COLOR 14
  PRINT CHR$(42)
  FOR i = 1 TO 5000 'delay
  NEXT i
  button = INKEY$
  FOR i = 1 TO n
    LOCATE x(i), y(i)
    PRINT " "
  NEXT i

  IF button = "w" THEN direction = "up"
  IF button = "s" THEN direction = "down"
  IF button = "a" THEN direction = "left"
  IF button = "d" THEN direction = "right"

  IF (direction = "up") AND (x(1) > 3) THEN
    IF n > 1 THEN
      FOR i = n TO 2 STEP -1
        x(i) = x(i - 1)
        y(i) = y(i - 1)
      NEXT i
    END IF
    x(1) = x(1) - 1
  END IF

  IF (direction = "right") AND (y(1) < 79) THEN
    IF n > 1 THEN
      FOR i = n TO 2 STEP -1
        x(i) = x(i - 1)
        y(i) = y(i - 1)
      NEXT i
    END IF
    y(1) = y(1) + 1
  END IF

  IF (direction = "down") AND (x(1) < 22) THEN
    IF n > 1 THEN
      FOR i = n TO 2 STEP -1
        x(i) = x(i - 1)
        y(i) = y(i - 1)
      NEXT i
    END IF
    x(1) = x(1) + 1
  END IF

  IF (direction = "left") AND (y(1) > 2) THEN
    IF n > 1 THEN
      FOR i = n TO 2 STEP -1
        x(i) = x(i - 1)
        y(i) = y(i - 1)
      NEXT i
    END IF
    y(1) = y(1) + 1
  END IF

  IF (x(1) = a) AND (y(1) = b) THEN
    a = INT(RND * 20) + 3
    b = INT(RND * 77) + 2
    s = s + n
    n = n + 1
    IF direction = "up" THEN
      x(n) = x(1) + 1
      y(n) = y(1)
    END IF
    IF direction = "down" THEN
      x(n) = x(1) - 1
      y(n) = y(1)
    END IF
    IF direction = "left" THEN
      x(n) = x(1)
      y(n) = y(1) + 1
    END IF
    IF direction = "right" THEN
      x(n) = x(1)
      y(n) = y(1) - 1
    END IF
    LOCATE 1, 66
    PRINT s
  END IF

LOOP UNTIL button = CHR$(27)
COLOR 7
END

Yesterday, I was rewriting it on my laptop and noticed that I made game loop without knowing about it at all XD


Edited by Aurioch, 22 July 2013 - 04:17 AM.






PARTNERS