/usr/share/perl5/Games/PangZero/SeekerBall.pm is in pangzero 1.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ##########################################################################
package Games::PangZero::SeekerBall;
##########################################################################
@ISA = qw( Games::PangZero::Ball );
use strict;
use warnings;
sub new {
my $class = shift;
my $self = Games::PangZero::Ball->new(@_);
my @guys = grep {ref $_ eq 'Games::PangZero::Guy'} @Games::PangZero::GameObjects;
$self->{target} = $guys[$Games::PangZero::Game->Rand(scalar @guys)];
$self->{deltaX} = (-$self->{w} + $self->{target}->{w}) / 2;
die unless $self->{target};
bless $self, $class;
}
sub NormalAdvance {
my $self = shift;
my $multiplier = ($self->{y} > $Games::PangZero::ScreenHeight - 120) ? 0 : 25;
unless( $Games::PangZero::GamePause > 0 ) {
if ($self->{x} + $self->{speedX} * $multiplier > $self->{target}->{x} + $self->{deltaX}) {
$self->{speedX} -= 0.08;
} else {
$self->{speedX} += 0.08;
}
}
$self->SUPER::NormalAdvance();
}
sub AdjustChildren {
my ($self, $child1, $child2) = @_;
$self->SUPER::AdjustChildren($child1, $child2);
$child1->{speedX} *= 2;
$child1->{deltaX} -= 30;
$child1->{target} = $self->{target};
$child2->{speedX} *= 2;
$child2->{deltaX} += 30;
$child2->{target} = $self->{target};
}
sub GiveMagic {
}
sub Draw {
my $self = shift;
$self->SUPER::Draw();
my $guySurface = $self->{target}->{player}->{guySurface};
my $srcrect = ($self->{w} <= 32)
? SDL::Rect->new(320, 176, 16, 16)
: SDL::Rect->new(320, 128, 32, 32);
my $dstrect = SDL::Rect->new(
$self->{x} + $Games::PangZero::ScreenMargin + ($self->{w} - $srcrect->w()) / 2,
$self->{y} + $Games::PangZero::ScreenMargin + ($self->{h} - $srcrect->h()) / 2 + 2, $srcrect->w, $srcrect->h);
SDL::Video::blit_surface($guySurface, $srcrect, $Games::PangZero::App, $dstrect);
}
1;
|