Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. if (Mark.GetGlobalBounds().Intersects(Ball.GetGlobalBounds()))
  2. {
  3. if (Keyboard.IsKeyPressed(Keyboard.Key.W))
  4. {
  5. Ball.Position = new Vector2f(Mark.Position.X, Mark.Position.Y);
  6. }
  7. if (Keyboard.IsKeyPressed(Keyboard.Key.A))
  8. {
  9. if (Mark.Position.X > Ball.Position.X - 50 && Mark.Position.X < Ball.Position.X + 50)
  10. {
  11. //Ball go along with the player
  12. Ball.Position = new Vector2f(Mark.Position.X, Mark.Position.Y);
  13. }
  14. }
  15. if (Keyboard.IsKeyPressed(Keyboard.Key.S))
  16. {
  17. if (Mark.Position.Y > Ball.Position.Y - 50 && Mark.Position.Y < Ball.Position.Y + 50)
  18. {
  19. //Ball go along with the player
  20. Ball.Position = new Vector2f(Mark.Position.X, Mark.Position.Y);
  21. Dictionary<string, Sprite> myDictionary = new Dictionary<string, Sprite>();
  22. }
  23. }
  24. if (Keyboard.IsKeyPressed(Keyboard.Key.D))
  25. {
  26. if (Mark.Position.Y > Ball.Position.Y - 50 && Mark.Position.Y < Ball.Position.Y + 50)
  27. {
  28. //Ball go along with the player
  29. Ball.Position = new Vector2f(Mark.Position.X, Mark.Position.Y);
  30. }
  31. }
  32. //the same with the A, S and D
  33. } // I don't know if is Global or Local
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement