Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Copyright (C) The Holy Ghost 2017
- ###This program is released under the GPL 3.0 and artistic license 2.0.
- unit module Box;
- class Holly6Game::Box {
- has $.x;
- has $.y;
- has $.w;
- has $.h;
- submethod BUILD($x, $y, $w, $h) {
- .x = $x;
- .y = $y;
- .w = $w;
- .h = $h;
- }
- submethod is_collision(Holly6Game::Box $box) is export {
- if (.x < $box.x) {
- return 0;
- }
- if (.x + .w > $box.x + $box.w) {
- return 0;
- }
- if (.y < $box.y) {
- return 0;
- }
- if (.y + .h > $box.y + $box.h) {
- return 0;
- }
- return 1;
- }
- }
- #sub EXPORT
- #{
- # %(
- # '$x' => shift(@_),
- # '$y' => shift(@_),
- # '$w' => shift(@_),
- # '$h' => shift(@_),
- # )
- #}
- ### Copyright (C) The Holy Ghost 2017
- ###This program is released under the GPL 3.0 and artistic license 2.0.
- use Sprite;
- unit module Enemy;
- class Holly6Game::Enemy is Sprite {
- }
- ### Copyright (C) The Holy Ghost 2017
- ###This program is released under the GPL 3.0 and artistic license 2.0.
- use Box;
- unit module Sprite;
- class Holly6Game::Sprite {
- has $.box;
- submethod BUILD($box) is export {
- .box = $box;
- }
- submethod draw() {
- }
- submethod update() {
- }
- }
- #sub EXPORT
- #{
- # %(
- # '$box' => Box.new(shift,shift,shift,shift),
- # ),
- #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement