Ejemplo n.º 1
0
        public override void Update(Vector2 _offset)
        {
            if (Globals.keyboard.GetPress("A"))
            {
                pos = new Vector2(pos.X - speed, pos.Y);
            }
            if (Globals.keyboard.GetPress("D"))
            {
                pos = new Vector2(pos.X + speed, pos.Y);
            }
            if (Globals.keyboard.GetPress("W"))
            {
                pos = new Vector2(pos.X, pos.Y - speed);
            }
            if (Globals.keyboard.GetPress("S"))
            {
                pos = new Vector2(pos.X, pos.Y + speed);
            }

            if (Globals.mouse.LeftClick())
            {
                GameGlobals.PassProjectile(new Bullet("2d\\bullet", new Vector2(pos.X, pos.Y), new Vector2(100, 100), this, new Vector2(Globals.mouse.newMousePos.X, Globals.mouse.newMousePos.Y)));
            }

            base.Update(_offset);
        }
Ejemplo n.º 2
0
        public override void Update()
        {
            Globals.camera.Follow(this);
            updateVelocity(this, Globals.keyboard);
            updatePosition(this);

            if (Globals.mouse.LeftClick())
            {
                GameGlobals.PassProjectile(new Fireball(new Vector2(pos.X, pos.Y), this, new Vector2(Globals.mouse.newMousePos.X, Globals.mouse.newMousePos.Y)));
            }
            if (Globals.mouse.RightClick())
            {
                GameGlobals.PassMonster(new Frog(20, new Vector2(Globals.mouse.newMousePos.X, Globals.mouse.newMousePos.Y), new Vector2(100, 100)));
            }
            base.Update();
        }