| 1 | ########################################################################## | ||
| 2 | package Games::PangZero::EarthquakeBall; | ||
| 3 | ########################################################################## | ||
| 4 | |||
| 5 | @ISA = qw(Games::PangZero::Ball); | ||
| 6 | use strict; | ||
| 7 | use warnings; | ||
| 8 | |||
| 9 | sub new { | ||
| 10 | my $class = shift; | ||
| 11 | my $self = Games::PangZero::Ball->new(@_); | ||
| 12 | bless $self, $class; | ||
| 13 | } | ||
| 14 | |||
| 15 | sub CountEarthquakeBalls { | ||
| 16 | my $count = 0; | ||
| 17 | |||
| 18 | foreach my $ball (@Games::PangZero::GameObjects) { | ||
| 19 | if (ref($ball) eq 'Games::PangZero::EarthquakeBall') { ++$count; } | ||
| 20 | } | ||
| 21 | return $count; | ||
| 22 | } | ||
| 23 | |||
| 24 | sub Bounce { | ||
| 25 | my $self = shift; | ||
| 26 | |||
| 27 | unless ($Games::PangZero::GameEvents{earthquake} and $Games::PangZero::GameEvents{earthquake} > $self->{desc}->{quake}) { | ||
| 28 | $Games::PangZero::GameEvents{earthquake} = [$self->{desc}->{quake}, $self->{x}]; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | 1; |