Pseudomander has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently working on a top down space shooter engine and was trying to compress my plane animation script At the moment I have:
glBegin(GL_POLYGON); @pos=($_[0],$_[1]); my $rot = $_[2]*0.0174; my @point1=($pos[0],$pos[1]); my @point2=($point1[0]+(cos($rot+90)*10),$point1[1]+(sin($rot+90)*10)) +; my @point3=($point2[0]+(cos($rot+45)*6),$point2[1]+(sin($rot+45)*6)); my @point4=($point3[0]+(cos($rot)*4),$point3[1]+(sin($rot)*4)); my @point5=($point4[0]-(cos($rot+225)*8),$point4[1]-(sin($rot+225)*8)) +; glVertex2f($point1[0],$point1[1]); glVertex2f($point2[0],$point2[1]); glVertex2f($point3[0],$point3[1]); glVertex2f($point4[0],$point4[1]); glVertex2f($point5[0],$point5[1]);
Which I replaced with :
However I'm getting no display at all yet no errors. Could someone give me a bump in the right direction?my @ang=(0,90,45,0,225); my @dist=(0,10,6,4,8); my $rot = $_[2]*0.0174; my $points=[]; my @prev=($_[0],$_[1]); glBegin(GL_POLYGON); for ($posi =1,$posi<5,$posi++){ @prev=($prev[0]+(cos($rot+$ang[$posi])*$dist[$posi]),$prev[1]+(sin($ +rot+$ang[$posi])*$dist[$posi])); $points[$posi]=($prev[0],$prev[1]); glVertex2f($prev[0],$prev[1]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data not acting as expected.
by mbethke (Hermit) on Mar 23, 2012 at 03:17 UTC | |
|
Re: Data not acting as expected.
by CountZero (Bishop) on Mar 23, 2012 at 07:01 UTC |