lib/Game/HeroesVsAliens/Hero/Blue.pm

filter: Statementstmt 75.0% 6 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 72.7% 8 / 11 CC 1 SCAR 2.9
CC
1
Cov
75%
add_projectile
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/Game/HeroesVsAliens/Role/ResourceDirectory.pm ↑ Summary lib/Game/HeroesVsAliens/Role/Hero.pm »
1 package Game::HeroesVsAliens::Hero::Blue;
2  
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 with 'Game::HeroesVsAliens::Role::Hero';
6  
7 1 ▶use Game::HeroesVsAliens::Projectile::Blue;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 has health => (
10 is => 'rw',
11 default => sub { 100 }
12 );
13  
14 has death_sprite => (
15 is => 'rw',
16 default => sub {
17 my $sprite = SDLx::Sprite::Animated->new(
18 image => $_[0]->resource_directory . 'resources/boy-hero-death.png',
19 width => 100,
20 height => 100
21 );
22 return $sprite;
23 }
24 );
25  
26  
27 has idle_sprite => (
28 is => 'rw',
29 default => sub {
30 my $sprite = SDLx::Sprite::Animated->new(
31 image => $_[0]->resource_directory . 'resources/boy-hero-idle.png',
32 width => 100,
33 height => 100,
34 type => 'reverse'
35 );
36 return $sprite;
37 }
38 );
39  
40 has shooting_sprite => (
41 is => 'rw',
42 default => sub {
43 my $sprite = SDLx::Sprite::Animated->new(
44 image => $_[0]->resource_directory . 'resources/boy-hero-shooting.png',
45 width => 100,
46 height => 100,
47 );
48 }
49 );
50  
51 sub add_projectile {
52 0 ▶ my ($self, $app) = @_;
Subroutine add_projectile: not called CC=1 SCAR=6.9
53 0 $self->projectiles->push(Game::HeroesVsAliens::Projectile::Blue->new({
54 x => $self->x + 70,
55 y => $self->y + 15,
56 }));
57 }
58  
59 1;
« lib/Game/HeroesVsAliens/Role/ResourceDirectory.pm ↑ Summary lib/Game/HeroesVsAliens/Role/Hero.pm »