public testObject(MonoGameLibrary.Game game, Screen screen, int x, int y, int width, int height) : base(game, screen, Assets.enemy, x, y, width, height)
        {
            TextureAnimator a = new TextureAnimator(game, this, Assets.smoke, 360, 0, 0.016);

            Animators.Add(a);
            a.Start();
        }
Esempio n. 2
0
        public override void Update(double deltaTime)
        {
            base.Update(deltaTime);

            int res = CollisionTest(parent.Objects);

            if (Input.IsKeyDown(Keys.Right) && VelocityX < 500)
            {
                VelocityX += 50;
            }

            if (Input.IsKeyDown(Keys.Left) && VelocityX > -500)
            {
                if (VelocityX > 450 && res == 4)
                {
                    a.Start();
                }
                if (VelocityX > 0)
                {
                    VelocityX -= 20;
                }
                else
                {
                    VelocityX -= 50;
                }
            }

            if (VelocityX < 11 && VelocityX > -11)
            {
                VelocityX = 0;
            }

            if (a.Enable && VelocityX < 40 && VelocityX > -40)
            {
                a.Stop();
            }

            if (!Input.IsKeyDown(Keys.Left) && !Input.IsKeyDown(Keys.Right))
            {
                if (VelocityX > 0)
                {
                    VelocityX -= 20;
                }
                else if (VelocityX < 0)
                {
                    VelocityX += 20;
                }
            }


            if (Input.onKeyDown(Keys.Space))
            {
                Console.WriteLine("ju");
                VelocityY = -1500;
            }
        }