Guest User

Untitled

a guest
Jun 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. require 'gosu'
  2.  
  3. Width = 640
  4. Height = 480
  5.  
  6. class Player
  7. def initialize(window)
  8. @window = window
  9.  
  10. @w = 25
  11. @h = 100
  12.  
  13. @x = 0
  14. @y = Height / 2 - @h / 2
  15. end
  16.  
  17. def draw
  18. c = 0xFFFFFF
  19. @window.draw_quad(
  20. 0, 0, c,
  21. 0, 10, c,
  22. 10, 0, c,
  23. 10, 10, c
  24. #@x, @y, c,
  25. #@x, @y + @h, c,
  26. #@x + @w, @y, c,
  27. #@x + @w, @y + @h, c
  28. )
  29. end
  30. end
  31.  
  32. class Window < Gosu::Window
  33. def initialize
  34. super(Width, Height, false)
  35. self.caption = "Pong"
  36.  
  37. @player1 = Player.new(self)
  38. end
  39.  
  40. def draw
  41. @player1.draw()
  42. end
  43. end
  44.  
  45. Window.new.show
Add Comment
Please, Sign In to add comment