projects
/
perl-landing-airplanes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
697ccdc
)
correctly center airplane
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 20 May 2010 15:00:15 +0000
(17:00 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 20 May 2010 15:00:15 +0000
(17:00 +0200)
Airplane.pm
patch
|
blob
|
history
diff --git
a/Airplane.pm
b/Airplane.pm
index
0b49c85
..
0078cb4
100644
(file)
--- a/
Airplane.pm
+++ b/
Airplane.pm
@@
-36,10
+36,6
@@
sub draw {
$self->{tick} = 0;
return;
}
$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(
# $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 $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;
$rotated->blit( $rotated->rect, $self->{app}, $to );
warn "$pos $radian $deg ", $rotated->width, ' ', $rotated->height;