#include <smoke_cloud.hpp>
Inherits GameObject.
Public Member Functions | |
SmokeCloud (const Vector &pos) | |
~SmokeCloud () | |
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 | |
SmokeCloud (const SmokeCloud &) | |
SmokeCloud & | operator= (const SmokeCloud &) |
Private Attributes | |
SpritePtr | sprite |
Timer | timer |
Vector | position |
Definition at line 28 of file smoke_cloud.hpp.
SmokeCloud::SmokeCloud | ( | const Vector & | pos | ) |
Definition at line 22 of file smoke_cloud.cpp.
References SpriteManager::create(), sprite, sprite_manager, Timer::start(), and timer.
00022 : 00023 sprite(), 00024 timer(), 00025 position(pos) 00026 { 00027 timer.start(.3f); 00028 sprite = sprite_manager->create("images/objects/particles/stomp.sprite"); 00029 }
SmokeCloud::~SmokeCloud | ( | ) |
SmokeCloud::SmokeCloud | ( | const SmokeCloud & | ) | [private] |
void SmokeCloud::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 36 of file smoke_cloud.cpp.
References Timer::check(), position, GameObject::remove_me(), timer, and Vector::y.
00037 { 00038 position.y -= 120 * elapsed_time; 00039 00040 if(timer.check()) 00041 remove_me(); 00042 }
void SmokeCloud::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Definition at line 45 of file smoke_cloud.cpp.
References LAYER_OBJECTS, position, and sprite.
00046 { 00047 sprite->draw(context, position, LAYER_OBJECTS+1); 00048 }
SmokeCloud& SmokeCloud::operator= | ( | const SmokeCloud & | ) | [private] |
SpritePtr SmokeCloud::sprite [private] |
Timer SmokeCloud::timer [private] |
Vector SmokeCloud::position [private] |