Example #1
0
        void MG.IUpdateable.Update(MG.GameTime gameTime)
        {
            string gtstr = gameTime.ToString();

            Nez.Debug.log(gtstr);
            entity.scene.camera.position = new MG.Vector2(entity.scene.sceneRenderTargetSize.X / 2, entity.scene.sceneRenderTargetSize.Y / 2);
            if (Nez.Input.isKeyPressed(MG.Input.Keys.A))
            {
                _direction.X           = -1f;
                _sprite.flipY          = false;
                entity.rotationDegrees = 90f;
            }
            else if (Nez.Input.isKeyPressed(MG.Input.Keys.D))
            {
                _direction.X           = 1f;
                _sprite.flipY          = false;
                entity.rotationDegrees = -90f;
            }
            else if (Nez.Input.isKeyPressed(MG.Input.Keys.W))
            {
                _direction.Y           = -1f;
                _sprite.flipY          = true;
                entity.rotationDegrees = 0f;
            }
            else if (Nez.Input.isKeyPressed(MG.Input.Keys.S))
            {
                _direction.Y           = 1f;
                _sprite.flipY          = false;
                entity.rotationDegrees = 0f;
            }

            if (_direction != MG.Vector2.Zero)
            {
                var movement = _direction * _speed * Nez.Time.deltaTime;
                Nez.CollisionResult collision;
                _mover.move(movement, out collision);
            }
        }