Exemplo n.º 1
0
        public void Initialize(Vector2 initialPosition, int shootDirection, Texture2D texture, float Damage, ConnectionTest con)
        {
            speed = 25f;
            this.con = con;
            direction = shootDirection;

               // Console.WriteLine("new projectile");
            Position = initialPosition;

            sprite = new Animation();

            sprite.Initialize(texture, Position, 64, 64, 3, 30, Color.White, 1, true);

            this.Damage = Damage;
            Active = true;

            spawnDuration = TimeSpan.FromSeconds(.5f);

            lifeTime = new Stopwatch();
            lifeTime.Start();
        }
Exemplo n.º 2
0
        public override void Initialize(List<Texture2D> charactersTexture, GraphicsDevice graphicsDevice, ConnectionTest con, Enemy enemy, int playerChar)
        {
            character = new Character();

            character.Initialize(charactersTexture, playerChar, graphicsDevice);
            Position = new Vector2(graphicsDevice.Viewport.TitleSafeArea.X + character.Width / 2,
                graphicsDevice.Viewport.TitleSafeArea.Y + character.Height / 2
                + graphicsDevice.Viewport.TitleSafeArea.Height / 2);

            previousPosition = Position;
            Active = true;
            shootDirection = 0;
            Health = character.Health;

            //Init projectile
            projectileTexture = charactersTexture.ElementAt(0);
            projectiles = new List<Projectile>();

            this.enemy = enemy;

            oldState = Keyboard.GetState();

            base.Initialize(charactersTexture, graphicsDevice, con, enemy, playerChar);
        }
Exemplo n.º 3
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

            bgColor = new Color(0, 167, 254);

            //State of the game.
            GameState = STATE.InitialMenu;

            playerChar = 0;

            //Create the two players
            player = new Player();
            enemy = new Enemy();

            level = new Level();

            //Create the menu
            initMenu = new InitialMenu();
            charMenu = new CharacterSelection();
            waitingMenu = new WaitingPlayersMenu();

            //List for barriers; Helpers for spawning new barriers each .5 seconds
            barriers = new List<Barrier>();
            previousBarrierSpawnTime = TimeSpan.Zero;
            barrierSpawnTime = TimeSpan.FromSeconds(.5f);
            //Barreir position
            bPo = new Vector2(8, 8);
            //Random number for the position of the new barriers (not using now)
            random = new Random();

            //New camera object
            _camera = new Camera(GraphicsDevice.Viewport);

            //Create a connection with the server (actual: localhost)
            con = new ConnectionTest();

            base.Initialize();
        }
Exemplo n.º 4
0
 // Initialize for Enemy
 public virtual void Initialize(List<Texture2D> charactersTexture, GraphicsDevice graphicsDevice, ConnectionTest con, Player player, int playerChar)
 {
     this.graphicsDevice = graphicsDevice;
     this.con = con;
 }