X-Git-Url: http://git.rot13.org/?p=perl-landing-airplanes.git;a=blobdiff_plain;f=Airplane.pm;h=0078cb4041ce13bd85555ca88b9dafc5ff5d4c71;hp=0b49c85d9e25455a402d00695829bf9db39c65aa;hb=4361ed72f1bcfcd545354266c7b8fb3362d33a19;hpb=5192d201a22360e15b9fe6c9e02a8d004315adfa diff --git a/Airplane.pm b/Airplane.pm index 0b49c85..0078cb4 100644 --- a/Airplane.pm +++ b/Airplane.pm @@ -36,10 +36,6 @@ sub draw { $self->{tick} = 0; return; } - my $to = SDL::Rect->new( - -x => $self->{path}[$pos], - -y => $self->{path}[$pos+1], - ); # $plane->blit( $plane->rect, $self->{app}, $to ); my $radian = atan2( @@ -52,6 +48,12 @@ sub draw { my $plane = SDL::Surface->new( -name => 'artwork/airplane.png' ); my $rotated = $tool->rotoZoom( $plane, $deg, 1, 1 ); + + my $to = SDL::Rect->new( + -x => $self->{path}[$pos] - $rotated->width / 2, + -y => $self->{path}[$pos+1] - $rotated->height / 2, + ); + $rotated->blit( $rotated->rect, $self->{app}, $to ); warn "$pos $radian $deg ", $rotated->width, ' ', $rotated->height;