Skip to content

Commit

Permalink
InvisibleWall: inherit from MovingObject, remove unnecessary code (Su…
Browse files Browse the repository at this point in the history
  • Loading branch information
maxteufel committed Jun 5, 2016
1 parent 74d428e commit fa4ff5c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
19 changes: 14 additions & 5 deletions src/object/invisible_wall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
#include "supertux/object_factory.hpp"
#include "util/reader_mapping.hpp"

InvisibleWall::InvisibleWall(const ReaderMapping& lisp) :
MovingSprite(lisp, "images/objects/invisible/invisible.sprite", LAYER_TILES, COLGROUP_STATIC),
physic(),
width(),
height()
InvisibleWall::InvisibleWall(const ReaderMapping& lisp)
{
float width, height;

if (!lisp.get("width", width)) width = 32;
if (!lisp.get("height", height)) height = 32;

bbox.set_size(width, height);
}

Expand All @@ -36,4 +35,14 @@ InvisibleWall::collision(GameObject& , const CollisionHit& )
return FORCE_MOVE;
}

void
InvisibleWall::draw(DrawingContext& )
{
}

void
InvisibleWall::update(float )
{
}

/* EOF */
11 changes: 5 additions & 6 deletions src/object/invisible_wall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@
#ifndef HEADER_SUPERTUX_OBJECT_INVISIBLE_WALL_HPP
#define HEADER_SUPERTUX_OBJECT_INVISIBLE_WALL_HPP

#include "object/moving_sprite.hpp"
#include "supertux/physic.hpp"
#include "supertux/moving_object.hpp"
#include "util/reader_fwd.hpp"

/** A tile that starts falling down if tux stands to long on it */
class InvisibleWall : public MovingSprite
class InvisibleWall : public MovingObject
{
public:
InvisibleWall(const ReaderMapping& lisp);

HitResponse collision(GameObject& other, const CollisionHit& hit);

private:
Physic physic;
float width, height;
void draw(DrawingContext& context);
void update(float elapsed_time);
};

#endif
Expand Down

0 comments on commit fa4ff5c

Please sign in to comment.