EndSequenceWalkLeft Class Reference

#include <endsequence_walkleft.hpp>

Inherits EndSequence.

List of all members.

Public Member Functions

 EndSequenceWalkLeft ()
virtual ~EndSequenceWalkLeft ()
virtual void draw (DrawingContext &context)
 The GameObject should draw itself onto the provided DrawingContext if this function is called.

Protected Member Functions

virtual void starting ()
 called when EndSequence starts
virtual void running (float elapsed_time)
 called while the EndSequence is running
virtual void stopping ()
 called when EndSequence stops

Private Attributes

float last_x_pos
Timer endsequence_timer


Detailed Description

Definition at line 23 of file endsequence_walkleft.hpp.


Constructor & Destructor Documentation

EndSequenceWalkLeft::EndSequenceWalkLeft (  ) 

Definition at line 23 of file endsequence_walkleft.cpp.

00023                                          :
00024   EndSequence(),
00025   last_x_pos(),
00026   endsequence_timer()
00027 {
00028 }

EndSequenceWalkLeft::~EndSequenceWalkLeft (  )  [virtual]

Definition at line 30 of file endsequence_walkleft.cpp.

00031 {
00032 }


Member Function Documentation

void EndSequenceWalkLeft::draw ( DrawingContext context  )  [virtual]

The GameObject should draw itself onto the provided DrawingContext if this function is called.

Reimplemented from EndSequence.

Definition at line 35 of file endsequence_walkleft.cpp.

00036 {
00037 }

void EndSequenceWalkLeft::starting (  )  [protected, virtual]

called when EndSequence starts

Reimplemented from EndSequence.

Definition at line 40 of file endsequence_walkleft.cpp.

References endsequence_timer, g_screen_manager, ScreenManager::get_speed(), last_x_pos, Timer::start(), and EndSequence::starting().

00041 {
00042   EndSequence::starting();
00043   last_x_pos = -1;
00044   endsequence_timer.start(7.3f * g_screen_manager->get_speed());
00045 }

void EndSequenceWalkLeft::running ( float  elapsed_time  )  [protected, virtual]

called while the EndSequence is running

Reimplemented from EndSequence.

Definition at line 48 of file endsequence_walkleft.cpp.

References Timer::check(), Sector::current(), EndSequence::end_sequence_controller, endsequence_timer, MovingObject::get_pos(), EndSequence::isdone, Controller::JUMP, last_x_pos, Controller::LEFT, Sector::player, CodeController::press(), EndSequence::running(), EndSequence::tux_may_walk, and Vector::x.

00049 {
00050   EndSequence::running(elapsed_time);
00051   Player& tux = *Sector::current()->player;
00052 
00053   if (tux_may_walk) {
00054     end_sequence_controller->press(Controller::LEFT);
00055     if (int(last_x_pos) == int(tux.get_pos().x)) {
00056       end_sequence_controller->press(Controller::JUMP);
00057     }
00058   }
00059 
00060   last_x_pos = tux.get_pos().x;
00061 
00062   if (endsequence_timer.check()) isdone = true;
00063 }

void EndSequenceWalkLeft::stopping (  )  [protected, virtual]

called when EndSequence stops

Reimplemented from EndSequence.

Definition at line 66 of file endsequence_walkleft.cpp.

References EndSequence::stopping().

00067 {
00068   EndSequence::stopping();
00069 }


Member Data Documentation

float EndSequenceWalkLeft::last_x_pos [private]

Definition at line 36 of file endsequence_walkleft.hpp.

Referenced by running(), and starting().

Timer EndSequenceWalkLeft::endsequence_timer [private]

Definition at line 37 of file endsequence_walkleft.hpp.

Referenced by running(), and starting().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:30 2014 for SuperTux by  doxygen 1.5.1