Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Owl: Added initial code for an "Owl" badguy.
Graphics are based on a drawing by Grumbel. The badguy simply flies from right to left for now. SVN-Revision: 6558
- Loading branch information
Florian Forster
committed
Mar 6, 2010
1 parent
c171b6f
commit 47acf21
Showing
11 changed files
with
297 additions
and
0 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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(supertux-sprite | ||
(action | ||
(name "left") | ||
(fps 10.0) | ||
(hitbox 14 7 35 45) | ||
(images "left-0.png" | ||
"left-1.png" | ||
"left-2.png" | ||
"left-3.png" | ||
"left-4.png" | ||
"left-5.png")) | ||
|
||
(action | ||
(name "right") | ||
(fps 10.0) | ||
(hitbox 14 7 35 45) | ||
(mirror-action "left")) | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,75 @@ | ||
// SuperTux | ||
// Copyright (C) 2008 Wolfgang Becker <uafr@gmx.de> | ||
// Copyright (C) 2010 Florian Forster <supertux at octo.it> | ||
// | ||
// 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 "badguy/owl.hpp" | ||
|
||
#include "audio/sound_manager.hpp" | ||
#include "sprite/sprite.hpp" | ||
#include "supertux/object_factory.hpp" | ||
|
||
#define FLYING_SPEED 120.0 | ||
|
||
Owl::Owl(const Reader& reader) : | ||
BadGuy(reader, "images/creatures/owl/owl.sprite") | ||
{ | ||
set_action (dir == LEFT ? "left" : "right", /* loops = */ -1); | ||
} | ||
|
||
Owl::Owl(const Vector& pos, Direction d) | ||
: BadGuy(pos, d, "images/creatures/owl/owl.sprite") | ||
{ | ||
set_action (dir == LEFT ? "left" : "right", /* loops = */ -1); | ||
} | ||
|
||
void | ||
Owl::initialize() | ||
{ | ||
physic.set_velocity_x(dir == LEFT ? -FLYING_SPEED : FLYING_SPEED); | ||
physic.enable_gravity(false); | ||
sprite->set_action(dir == LEFT ? "left" : "right"); | ||
} | ||
|
||
bool | ||
Owl::collision_squished(GameObject&) | ||
{ | ||
kill_fall (); | ||
return true; | ||
} | ||
|
||
void | ||
Owl::collision_solid(const CollisionHit& hit) | ||
{ | ||
if(hit.top || hit.bottom) { | ||
physic.set_velocity_y(0); | ||
} else if(hit.left || hit.right) { | ||
kill_fall (); | ||
} | ||
} | ||
|
||
HitResponse | ||
Owl::collision_player(Player& player, const CollisionHit& hit) | ||
{ | ||
//Hack to tell if we should die | ||
HitResponse response = BadGuy::collision_player(player, hit); | ||
if(response == FORCE_MOVE) { | ||
kill_fall (); | ||
} | ||
|
||
return ABORT_MOVE; | ||
} | ||
|
||
/* 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 @@ | ||
// SuperTux | ||
// Copyright (C) 2008 Wolfgang Becker <uafr@gmx.de> | ||
// Copyright (C) 2010 Florian Forster <supertux at octo.it> | ||
// | ||
// 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_BADGUY_OWL_HPP | ||
#define HEADER_SUPERTUX_BADGUY_OWL_HPP | ||
|
||
#include "badguy/badguy.hpp" | ||
|
||
class Owl : public BadGuy | ||
{ | ||
public: | ||
Owl(const Reader& reader); | ||
Owl(const Vector& pos, Direction d); | ||
|
||
void initialize(); | ||
void collision_solid(const CollisionHit& hit); | ||
|
||
protected: | ||
bool collision_squished(GameObject& object); | ||
HitResponse collision_player(Player& player, const CollisionHit& hit); | ||
}; | ||
|
||
#endif /* HEADER_SUPERTUX_BADGUY_OWL_HPP */ | ||
|
||
/* 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