Platform.cs 567 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Graphics;
  8. using Tutorial026.Interfaces;
  9. namespace Tutorial026.Sprites
  10. {
  11. public class Platform : Sprite, IMoveable
  12. {
  13. public Vector2 Velocity { get; set; }
  14. public Platform(Texture2D texture) : base(texture)
  15. {
  16. }
  17. public override void Update(GameTime gameTime)
  18. {
  19. Position += Velocity;
  20. if (Rectangle.Right < 0)
  21. IsRemoved = true;
  22. }
  23. }
  24. }