lib/Game/HeroesVsAliens/Role/Projectile.pm

filter: Statementstmt 37.9% 11 / 29 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 14.2% 1 / 7 Podpod 0.0% 0 / 2 totaltotal 27.2% 12 / 44 CC 4 SCAR 22.1
CC
4
Cov
31%
draw
20.0
__ANON__
2.0
__ANON__
2.0
CRAP 9.1
« lib/Game/HeroesVsAliens/Cell.pm ↑ Summary lib/Game/HeroesVsAliens/Bonus.pm »
1 package Game::HeroesVsAliens::Role::Projectile;
2  
3 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 with 'Game::HeroesVsAliens::Role::ResourceDirectory';
6  
7 1 has x => (
8 is => 'rw'
9 );
10  
11 1 has y => (
12 is => 'rw'
13 );
14  
15 has width => (
16 is => 'rw',
17 0 ▶ default => sub { 32 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
18 1 );
19  
20 has height => (
21 is => 'rw',
22 0 ▶ default => sub { 32 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 1 );
24  
25 has speed => (
26 is => 'rw',
27 0 ▶ default => sub { 5 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 1 );
29  
30 has collision => (
31 is => 'rw',
32 0 ▶ default => sub { 0 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 1 );
34  
35 sub draw {
36 0 ▶ my ($self, $app) = @_;
Subroutine draw: not called CC=4 SCAR=30.0
Pod undocumented
37  
38 0 ▶ if ($self->collision) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->collision) { } 0 0 0
39 0 $self->explode_sprite->rect->x($self->x);
40 0 $self->explode_sprite->rect->y($self->y);
41 0 ▶ if ($app->frame % 3 == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($app->frame % 3 == 0) 0 0 0
42 0 $self->explode_sprite->next;
43 }
44 0 $self->explode_sprite->draw($app->ctx);
45 } else {
46 0 $self->sprite->rect->x($self->x);
47 0 $self->sprite->rect->y($self->y);
48 0 ▶ if ($app->frame % 3 == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($app->frame % 3 == 0) 0 0 0
49 0 $self->sprite->next;
50 }
51 0 $self->sprite->draw($app->ctx);
52 }
53 # $app->draw_circle($self->x, $self->y, $self->width, $self->height, [200, 100, 200, 255]);
54 }
55  
56 sub update {
57 0 ▶ my ($self, $app) = @_;
Subroutine update: not called CC=1 SCAR=6.9
Pod undocumented
58 0 $self->x($self->x + $self->speed);
59 }
60  
61  
62 1 1;
« lib/Game/HeroesVsAliens/Cell.pm ↑ Summary lib/Game/HeroesVsAliens/Bonus.pm »