Exemple #1
0
        public Level(Game game)
        {
            Paused = true;

            Player = new Player(game.Content.Load<Texture2D>("scott"));

            BG = new Background();
            BG.Textures.Add(game.Content.Load<Texture2D>("Backgrounds/Background 1a"));
            BG.Scale = 1.4f;
            BG.Speed = 0.2f;

            Road = new Background();
            Road.Textures.Add(game.Content.Load<Texture2D>("Backgrounds/road"));
            Road.Speed = 10f;
            Road.Position = new Vector2(0, 270);

            Foreground = new Background();
            Foreground.Textures.Add(game.Content.Load<Texture2D>("Backgrounds/grass"));
            Foreground.Position = new Vector2(0, 315);
            Foreground.Speed = 12f;
            Foreground.Scale = 2;

            ObstacleTextures = new Texture2D[2];
            ObstacleTextures[0] = game.Content.Load<Texture2D>("barrel");
            ObstacleTextures[1] = game.Content.Load<Texture2D>("tevez2");

            JumpSound = game.Content.Load<SoundEffect>("Sounds/jump");
            Coin = game.Content.Load<SoundEffect>("Sounds/coin");
            Song = game.Content.Load<Song>("Music/Plasticidio");

            Obstacles = new List<Obstacle>();

            Input = new Input();

            Camera = new Camera(Util.Width, Util.Height, Player);
        }
Exemple #2
0
        /// <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

            player = new Player(new Vector2(100, 100));

            prevKeyboard = Keyboard.GetState();
            prevMouse = Mouse.GetState();
            rand = new Random();

            jumping = false;
            initJump = false;
            maxJump = 25;
            jumpHeight = 0;
            jumpTimer = 40;

            SCORE = 0;

            base.Initialize();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            bool flag = false;
            if (tbIme.Text == "")
            {
                MessageBox.Show("Vnesete Ime!");
                return;
            }
            if (cmbLevel.SelectedIndex == -1)
            {
                MessageBox.Show("Izberete level!");
                return;
            }
            foreach (Player p in players)
            {
                if (p.Nickname == tbIme.Text)
                {
                    flag = true;
                    p.Poeni = 0;
                }
            }
            if (flag == false)
            {
                Player p = new Player(tbIme.Text, 0);
                players.Add(p);
            }

            //this.Hide();
            if (cmbLevel.SelectedIndex == 0)
            {
                Program.Poeni = 0;
                Igra igra = new Igra();
                if (igra.ShowDialog() == DialogResult.Cancel)
                {

                }
            }

            if (cmbLevel.SelectedIndex == 1)
            {
                Program.Poeni = 0;
                Igraa1 igra1 = new Igraa1();
                if (igra1.ShowDialog() == DialogResult.Cancel)
                {

                }
            }

            if (cmbLevel.SelectedIndex == 2)
            {
                Program.Poeni = 0;
                Igra2 igra2 = new Igra2();
                if (igra2.ShowDialog() == DialogResult.Cancel)
                {

                }
            }
            for (int i = 0; i < players.Count; i++)
            {
                if (players[i].Nickname == tbIme.Text)
                {
                    players[i].Poeni = Program.Poeni;
                }
            }
        }