worldmap::Teleporter Class Reference

#include <teleporter.hpp>

Inherits GameObject.

List of all members.

Public Member Functions

 Teleporter (const Reader &lisp)
virtual void draw (DrawingContext &context)
 The GameObject should draw itself onto the provided DrawingContext if this function is called.
virtual void update (float elapsed_time)
 This function is called once per frame and allows the object to update it's state.

Public Attributes

Vector pos
 Position (in tiles, not pixels).
SpritePtr sprite
 Sprite to render, or 0 for no sprite.
std::string worldmap
 Worldmap filename (relative to data root) to teleport to.
std::string spawnpoint
 Spawnpoint to teleport to.
bool automatic
 true if this teleporter does not need to be activated, but teleports Tux as soon as it's touched
std::string message
 optional map message to display


Detailed Description

Definition at line 31 of file teleporter.hpp.


Constructor & Destructor Documentation

worldmap::Teleporter::Teleporter ( const Reader lisp  ) 

Definition at line 26 of file teleporter.cpp.

References automatic, SpriteManager::create(), lisp::Lisp::get(), message, pos, spawnpoint, sprite, sprite_manager, worldmap, Vector::x, and Vector::y.

00026                                          :
00027   pos(),
00028   sprite(),
00029   worldmap(),
00030   spawnpoint(),
00031   automatic(false),
00032   message()
00033 {
00034   lisp.get("x", pos.x);
00035   lisp.get("y", pos.y);
00036 
00037   std::string spritefile = "";
00038   if (lisp.get("sprite", spritefile)) {
00039     sprite = sprite_manager->create(spritefile);
00040   }
00041 
00042   lisp.get("worldmap", worldmap);
00043   lisp.get("spawnpoint", spawnpoint);
00044   lisp.get("automatic", automatic);
00045   lisp.get("message", message);
00046 }


Member Function Documentation

void worldmap::Teleporter::draw ( DrawingContext context  )  [virtual]

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

Implements GameObject.

Definition at line 49 of file teleporter.cpp.

References LAYER_OBJECTS, pos, and sprite.

00050 {
00051   if (sprite.get() != 0) sprite->draw(context, pos*32 + Vector(16, 16), LAYER_OBJECTS - 1);
00052 }

void worldmap::Teleporter::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 55 of file teleporter.cpp.

00056 {
00057 }


Member Data Documentation

Vector worldmap::Teleporter::pos

Position (in tiles, not pixels).

Definition at line 41 of file teleporter.hpp.

Referenced by draw(), and Teleporter().

SpritePtr worldmap::Teleporter::sprite

Sprite to render, or 0 for no sprite.

Definition at line 44 of file teleporter.hpp.

Referenced by draw(), and Teleporter().

std::string worldmap::Teleporter::worldmap

Worldmap filename (relative to data root) to teleport to.

Leave empty to use current word

Definition at line 47 of file teleporter.hpp.

Referenced by Teleporter(), and worldmap::WorldMap::update().

std::string worldmap::Teleporter::spawnpoint

Spawnpoint to teleport to.

Leave empty to use "main" or last one

Definition at line 50 of file teleporter.hpp.

Referenced by Teleporter(), and worldmap::WorldMap::update().

bool worldmap::Teleporter::automatic

true if this teleporter does not need to be activated, but teleports Tux as soon as it's touched

Definition at line 53 of file teleporter.hpp.

Referenced by Teleporter(), and worldmap::WorldMap::update().

std::string worldmap::Teleporter::message

optional map message to display

Definition at line 56 of file teleporter.hpp.

Referenced by worldmap::WorldMap::draw_status(), and Teleporter().


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