File: Ball.pm

package info (click to toggle)
libtangence-perl 0.33-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 580 kB
  • sloc: perl: 6,076; makefile: 15
file content (36 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (2)
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
package t::Ball;

use v5.26;
use warnings;
use experimental 'signatures';

use base qw( Tangence::Object t::Colourable );

use Tangence::Constants;

sub new ( $class, %args )
{
   my $self = $class->SUPER::new( %args );

   $self->set_prop_colour( $args{colour} ) if defined $args{colour};
   $self->set_prop_size( $args{size} ) if defined $args{size};

   return $self;
}

sub describe
{
   my $self = shift;
   return (ref $self) . qq([colour=") . $self->get_prop_colour . q("]);
}

our $last_bounce_ctx;

sub method_bounce ( $self, $ctx, $howhigh )
{
   $last_bounce_ctx = $ctx;
   $self->fire_event( "bounced", $howhigh );
   return "bouncing";
}

1;