Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New BonusBlock content: 'explode' - a coin explosion.
Causes ten coins to be hurled through the air as an alternative to coin rain in covered areas such as cave levels. These coins are included in the level stats. Testable in test/bonusblock.stl.
- Loading branch information
Showing
10 changed files
with
156 additions
and
18 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// CoinExplode - several coins are hurled through the air | ||
// Copyright (C) 2013 LMH <lmh.0013@gmail.com> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#include "object/coin_explode.hpp" | ||
|
||
#include "math/random_generator.hpp" | ||
#include "object/coin.hpp" | ||
#include "supertux/sector.hpp" | ||
|
||
CoinExplode::CoinExplode(const Vector& pos, const int vert) : | ||
position(pos), | ||
y_velocity_weight(vert) // should generally be +/- 1 to send coins up or down respectively | ||
{ | ||
} | ||
|
||
void | ||
CoinExplode::update(float ) | ||
{ | ||
int mag = 100; // madnitude that coins are to be thrown | ||
int rand = 30; // max variation to be subtracted from magnitide | ||
|
||
//TODO: this needs its own snazzy sound | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (2.5,-4.5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (2,-5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (1.5,-5.5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (1,-6)*(mag+gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (0.5,-6.5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (-2.5,-4.5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (-2,-5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (-1.5,-5.5)*(mag-gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (-1,-6)*(mag+gameRandom.rand(rand)))); | ||
Sector::current()->add_object(new HeavyCoin(position, Vector (-0.5,-6.5)*(mag-gameRandom.rand(rand)))); | ||
|
||
remove_me(); | ||
} | ||
|
||
void | ||
CoinExplode::draw(DrawingContext &) | ||
{ | ||
} | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// CoinExplode - several coins are hurled through the air | ||
// Copyright (C) 2013 LMH <lmh.0013@gmail.com> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#ifndef HEADER_SUPERTUX_OBJECT_COIN_EXPLODE_HPP | ||
#define HEADER_SUPERTUX_OBJECT_COIN_EXPLODE_HPP | ||
|
||
#include <memory> | ||
|
||
#include "math/vector.hpp" | ||
#include "supertux/game_object.hpp" | ||
|
||
class CoinExplode : public GameObject | ||
{ | ||
public: | ||
CoinExplode(const Vector& pos, const int vert); | ||
virtual void update(float elapsed_time); | ||
virtual void draw(DrawingContext& context); | ||
|
||
private: | ||
Vector position; | ||
int y_velocity_weight; | ||
}; | ||
|
||
#endif | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters