Game-HeroesVsAliens

 view release on metacpan or  search on metacpan

lib/Game/HeroesVsAliens/Message.pm  view on Meta::CPAN


has color => (
	is => 'rw'
);

has opacity => (
	is => 'rw',
	default => sub { 1 } 
);

sub update {
	my ($self, $app) = @_;
	$self->y($self->y - 0.3);
	$self->life_span($self->life_span + 1);
	$self->opacity($self->opacity - 0.03) if ($self->opacity > 0.03);
}

sub draw {
	my ($self, $app) = @_;
	$app->draw_text(
		$self->x,

lib/Game/HeroesVsAliens/Projectile.pm  view on Meta::CPAN

		$self->sprite->rect->x($self->x);
		$self->sprite->rect->y($self->y);
		if ($app->frame % 3 == 0) {
			$self->sprite->next;
		}
		$self->sprite->draw($app->ctx);
	}
#	$app->draw_circle($self->x, $self->y, $self->width, $self->height, [200, 100, 200, 255]);
}

sub update {
	my ($self, $app) = @_;
	$self->x($self->x + $self->speed);
}


1;

lib/Game/HeroesVsAliens/Role/Alien.pm  view on Meta::CPAN

		$self->walking_sprite->rect->x($self->x);
		$self->walking_sprite->rect->y($self->y);
		if ($app->frame % 3 == 0) {
			$self->walking_sprite->next;
		}
		$self->walking_sprite->draw($app->ctx);
	}
	$app->draw_text($self->x + 15, $self->y + 15, 18, [255, 255, 255, 255], int($self->health))
}

sub update {
	my ($self, $app) = @_;
	$self->x($self->x - $self->movement);
}

1;

lib/Game/HeroesVsAliens/Role/Hero.pm  view on Meta::CPAN

		$self->idle_sprite->rect->x($self->x);
		$self->idle_sprite->rect->y($self->y);
		if ($app->frame % 3 == 0) {
			$self->idle_sprite->next;
		}
		$self->idle_sprite->draw($app->ctx);
	}
	$app->draw_text($self->x + 15, $self->y + 15, 18, [255, 255, 255, 255], int($self->health))
}

sub update {
	my ($self, $app) = @_;
	if ($self->shooting && !$self->block_shot) {
		if ($self->shooting_sprite->current_frame == 1) {
			$self->add_projectile($app);
			$self->block_shot(1);
		}
	} else {
		$self->timer(0);
	}
	$self->handle_projectiles($app);

lib/Game/HeroesVsAliens/Role/Projectile.pm  view on Meta::CPAN

		$self->sprite->rect->x($self->x);
		$self->sprite->rect->y($self->y);
		if ($app->frame % 3 == 0) {
			$self->sprite->next;
		}
		$self->sprite->draw($app->ctx);
	}
#	$app->draw_circle($self->x, $self->y, $self->width, $self->height, [200, 100, 200, 255]);
}

sub update {
	my ($self, $app) = @_;
	$self->x($self->x + $self->speed);
}


1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.011 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )