Advertisement
shineJazama

2

Feb 21st, 2025 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ** This class inherits rectangle and draw functions from base Sprite class **
  2.  
  3. class Player: Sprite
  4. {
  5. Texture2D image;
  6. Microsoft.Xna.Framework.Vector2 position;
  7.  
  8. public bool[] isMovingHor = new bool[2];
  9. //public bool[] isMovingVert = new bool[2];
  10. ContentManager content;
  11. public Player(Texture2D image, Vector2 position): base(image, position)
  12. {
  13. this.image = image;
  14. this.position = position;
  15. }
  16. public void Update()
  17. {
  18. if (isMovingHor[0]) // right
  19. {
  20. position.X += 5;
  21. }
  22. else if (isMovingHor[1]) // left
  23. {
  24. position.X -= 5;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement