From 6e54faec26a77edb5f7c9947db68ad0469712c61 Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Sat, 7 Aug 2010 12:28:38 -0400 Subject: [PATCH] Removed "stop" direction. --- lib/Games/Maze/SDL/Model.pm | 2 +- lib/Games/Maze/SDL/Types.pm | 2 +- lib/Games/Maze/SDL/View.pm | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Games/Maze/SDL/Model.pm b/lib/Games/Maze/SDL/Model.pm index 3595096..e7169c9 100644 --- a/lib/Games/Maze/SDL/Model.pm +++ b/lib/Games/Maze/SDL/Model.pm @@ -79,7 +79,7 @@ has 'player_y' => ( has 'player_direction' => ( is => 'rw', isa => 'Games::Maze::SDL::Direction', - default => 'stop', + default => 'south', ); has 'player_velocity' => ( diff --git a/lib/Games/Maze/SDL/Types.pm b/lib/Games/Maze/SDL/Types.pm index 1647e07..bd76b7d 100644 --- a/lib/Games/Maze/SDL/Types.pm +++ b/lib/Games/Maze/SDL/Types.pm @@ -4,6 +4,6 @@ package Games::Maze::SDL::Types; use Moose::Util::TypeConstraints; -enum 'Games::Maze::SDL::Direction' => qw(north south west east stop); +enum 'Games::Maze::SDL::Direction' => qw(north south west east); no Moose::Util::TypeConstraints; diff --git a/lib/Games/Maze/SDL/View.pm b/lib/Games/Maze/SDL/View.pm index 382748a..d6de76e 100644 --- a/lib/Games/Maze/SDL/View.pm +++ b/lib/Games/Maze/SDL/View.pm @@ -104,8 +104,6 @@ sub _build_player { $sprite->sequence( $self->model->player_direction ); - $sprite->start; - return $sprite; } @@ -190,8 +188,6 @@ sub draw_maze { sub draw_player { my ($self) = @_; - $self->player->sequence('stop') if $self->model->player_velocity == 0; - $self->player->draw( $self->display ); } @@ -219,8 +215,10 @@ sub handle_event { } elsif ( $event->{type} eq 'player_turned' ) { $self->player->sequence( $self->model->player_direction ); + $self->player->start; } elsif ( $event->{type} eq 'player_stopped' ) { + $self->player->reset; } }