SpecialRiser Class Reference

special object that contains another object and slowly rises it out of a bonus block. More...

#include <specialriser.hpp>

Inherits GameObject.

List of all members.

Public Member Functions

 SpecialRiser (Vector pos, MovingObject *child)
 ~SpecialRiser ()
virtual void update (float elapsed_time)
 This function is called once per frame and allows the object to update it's state.
virtual void draw (DrawingContext &context)
 The GameObject should draw itself onto the provided DrawingContext if this function is called.

Private Member Functions

 SpecialRiser (const SpecialRiser &)
SpecialRiseroperator= (const SpecialRiser &)

Private Attributes

float offset
MovingObjectchild


Detailed Description

special object that contains another object and slowly rises it out of a bonus block.

Definition at line 26 of file specialriser.hpp.


Constructor & Destructor Documentation

SpecialRiser::SpecialRiser ( Vector  pos,
MovingObject child 
)

Definition at line 21 of file specialriser.cpp.

References offset, and MovingObject::set_pos().

00021                                                            :
00022   offset(),
00023   child(_child)
00024 {
00025   _child->set_pos(pos - Vector(0, 32));
00026   offset = 0;
00027 }

SpecialRiser::~SpecialRiser (  ) 

Definition at line 29 of file specialriser.cpp.

00030 {
00031 }

SpecialRiser::SpecialRiser ( const SpecialRiser  )  [private]


Member Function Documentation

void SpecialRiser::update ( float  elapsed_time  )  [virtual]

This function is called once per frame and allows the object to update it's state.

The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)

Implements GameObject.

Definition at line 34 of file specialriser.cpp.

References Sector::add_object(), child, Sector::current(), offset, and GameObject::remove_me().

00035 {
00036   offset += 50 * elapsed_time;
00037   if(offset > 32) {
00038     Sector::current()->add_object(child);
00039     remove_me();
00040   }
00041 }

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

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

Implements GameObject.

Definition at line 44 of file specialriser.cpp.

References child, GameObject::draw(), DrawingContext::get_translation(), offset, DrawingContext::pop_transform(), DrawingContext::push_transform(), and DrawingContext::set_translation().

00045 {
00046   context.push_transform();
00047   context.set_translation(
00048     context.get_translation() + Vector(0, -32 + offset));
00049   child->draw(context);
00050   context.pop_transform();
00051 }

SpecialRiser& SpecialRiser::operator= ( const SpecialRiser  )  [private]


Member Data Documentation

float SpecialRiser::offset [private]

Definition at line 36 of file specialriser.hpp.

Referenced by draw(), SpecialRiser(), and update().

MovingObject* SpecialRiser::child [private]

Definition at line 37 of file specialriser.hpp.

Referenced by draw(), and update().


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