Guest User

Untitled

a guest
Apr 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. pub struct GameBoard {
  2. width: u8,
  3. height: u8,
  4. player_x: u8,
  5. player_y: u8,
  6. }
  7.  
  8. impl GameBoard {
  9. pub fn new(width: u8, height: u8) {
  10. GameBoard {
  11. width,
  12. height,
  13. player_x: 0,
  14. player_y: 0,
  15. }
  16. }
  17.  
  18. pub fn move_player(&mut self, x: u8, y:u8) {
  19. self.player_x = x;
  20. self.player_y = y;
  21. }
  22. }
Add Comment
Please, Sign In to add comment