Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. ### Copyright (C) The Holy Ghost 2017
  2. ###This program is released under the GPL 3.0 and artistic license 2.0.
  3.  
  4. unit module Box;
  5.  
  6. class Holly6Game::Box {
  7. has $.x;
  8. has $.y;
  9.  
  10. has $.w;
  11. has $.h;
  12.  
  13. submethod BUILD($x, $y, $w, $h) {
  14. .x = $x;
  15. .y = $y;
  16. .w = $w;
  17. .h = $h;
  18. }
  19.  
  20. submethod is_collision(Holly6Game::Box $box) is export {
  21. if (.x < $box.x) {
  22. return 0;
  23. }
  24. if (.x + .w > $box.x + $box.w) {
  25. return 0;
  26. }
  27. if (.y < $box.y) {
  28. return 0;
  29. }
  30. if (.y + .h > $box.y + $box.h) {
  31. return 0;
  32. }
  33. return 1;
  34. }
  35. }
  36.  
  37. #sub EXPORT
  38. #{
  39. # %(
  40. # '$x' => shift(@_),
  41. # '$y' => shift(@_),
  42. # '$w' => shift(@_),
  43. # '$h' => shift(@_),
  44. # )
  45. #}
  46. ### Copyright (C) The Holy Ghost 2017
  47. ###This program is released under the GPL 3.0 and artistic license 2.0.
  48.  
  49. use Sprite;
  50.  
  51. unit module Enemy;
  52.  
  53. class Holly6Game::Enemy is Sprite {
  54. }
  55.  
  56. ### Copyright (C) The Holy Ghost 2017
  57. ###This program is released under the GPL 3.0 and artistic license 2.0.
  58.  
  59. use Box;
  60.  
  61. unit module Sprite;
  62.  
  63. class Holly6Game::Sprite {
  64. has $.box;
  65.  
  66. submethod BUILD($box) is export {
  67. .box = $box;
  68. }
  69. submethod draw() {
  70. }
  71.  
  72. submethod update() {
  73. }
  74.  
  75. }
  76. #sub EXPORT
  77. #{
  78. # %(
  79. # '$box' => Box.new(shift,shift,shift,shift),
  80. # ),
  81. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement