Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed alternating speed for different directions

  • Loading branch information...
commit c6706d4e23bdbfc82036651181e282ab1f2872e4 1 parent edba708
Tobias Leich authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 Asteroids/Player.pm
4 Asteroids/Player.pm
View
@@ -104,8 +104,8 @@ sub move {
my $r = $app->stash->{player}->r;
- $app->stash->{player}->x( $app->stash->{player}->x + sin(deg2rad($r)) * $app->stash->{player}->v_m );
- $app->stash->{player}->y( $app->stash->{player}->y - cos(deg2rad($r)) * $app->stash->{player}->v_m );
+ $app->stash->{player}->x( int($app->stash->{player}->x + sin(deg2rad($r)) * $app->stash->{player}->v_m + 0.5) );
+ $app->stash->{player}->y( int($app->stash->{player}->y - cos(deg2rad($r)) * $app->stash->{player}->v_m + 0.5) );
$app->stash->{player}->x( $app->stash->{player}->x % $app->stash->{field}->w );
$app->stash->{player}->y( $app->stash->{player}->y % $app->stash->{field}->h );
Please sign in to comment.
Something went wrong with that request. Please try again.