Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Request to change the Boat by swimming Tux #1447

Merged
merged 2 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/images/worldmap/common/air_swim_down1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_down2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_down3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_down4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_down5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_left1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_left2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_left3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_left4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_left5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_up1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_up2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_up3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_up4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/air_swim_up5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_down1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_down2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_down3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_down4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_down5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_left1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_left2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_left3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_left4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_left5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/worldmap/common/big_swim_up1.png
Binary file added data/images/worldmap/common/big_swim_up2.png
Binary file added data/images/worldmap/common/big_swim_up3.png
Binary file added data/images/worldmap/common/big_swim_up4.png
Binary file added data/images/worldmap/common/big_swim_up5.png
2 changes: 1 addition & 1 deletion data/images/worldmap/common/boat/boat.sprite
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@
"boat_0_ice.png"
)
)
)
)
Binary file added data/images/worldmap/common/earth_swim_down1.png
Binary file added data/images/worldmap/common/earth_swim_down2.png
Binary file added data/images/worldmap/common/earth_swim_down3.png
Binary file added data/images/worldmap/common/earth_swim_down4.png
Binary file added data/images/worldmap/common/earth_swim_down5.png
Binary file added data/images/worldmap/common/earth_swim_left1.png
Binary file added data/images/worldmap/common/earth_swim_left2.png
Binary file added data/images/worldmap/common/earth_swim_left3.png
Binary file added data/images/worldmap/common/earth_swim_left4.png
Binary file added data/images/worldmap/common/earth_swim_left5.png
Binary file added data/images/worldmap/common/earth_swim_up1.png
Binary file added data/images/worldmap/common/earth_swim_up2.png
Binary file added data/images/worldmap/common/earth_swim_up3.png
Binary file added data/images/worldmap/common/earth_swim_up4.png
Binary file added data/images/worldmap/common/earth_swim_up5.png
Binary file added data/images/worldmap/common/fire_swim_down1.png
Binary file added data/images/worldmap/common/fire_swim_down2.png
Binary file added data/images/worldmap/common/fire_swim_down3.png
Binary file added data/images/worldmap/common/fire_swim_down4.png
Binary file added data/images/worldmap/common/fire_swim_down5.png
Binary file added data/images/worldmap/common/fire_swim_left1.png
Binary file added data/images/worldmap/common/fire_swim_left2.png
Binary file added data/images/worldmap/common/fire_swim_left3.png
Binary file added data/images/worldmap/common/fire_swim_left4.png
Binary file added data/images/worldmap/common/fire_swim_left5.png
Binary file added data/images/worldmap/common/fire_swim_up1.png
Binary file added data/images/worldmap/common/fire_swim_up2.png
Binary file added data/images/worldmap/common/fire_swim_up3.png
Binary file added data/images/worldmap/common/fire_swim_up4.png
Binary file added data/images/worldmap/common/fire_swim_up5.png
Binary file added data/images/worldmap/common/ice_swim_down1.png
Binary file added data/images/worldmap/common/ice_swim_down2.png
Binary file added data/images/worldmap/common/ice_swim_down3.png
Binary file added data/images/worldmap/common/ice_swim_down4.png
Binary file added data/images/worldmap/common/ice_swim_down5.png
Binary file added data/images/worldmap/common/ice_swim_left1.png
Binary file added data/images/worldmap/common/ice_swim_left2.png
Binary file added data/images/worldmap/common/ice_swim_left3.png
Binary file added data/images/worldmap/common/ice_swim_left4.png
Binary file added data/images/worldmap/common/ice_swim_left5.png
Binary file added data/images/worldmap/common/ice_swim_up1.png
Binary file added data/images/worldmap/common/ice_swim_up2.png
Binary file added data/images/worldmap/common/ice_swim_up3.png
Binary file added data/images/worldmap/common/ice_swim_up4.png
Binary file added data/images/worldmap/common/ice_swim_up5.png
304 changes: 304 additions & 0 deletions data/images/worldmap/common/swim.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
(supertux-sprite
(action
(hitbox 4 0 0 0)
(name "empty")
(images
"big_swim_up5.png"
)
)
(action
(hitbox 4 20 0 0)
(name "small-stop")
(images
"smalltux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "small-walking-up")
(fps 9)
(images
"big_swim_up1.png"
"big_swim_up2.png"
"big_swim_up3.png"
"big_swim_up4.png"
"big_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "small-walking-down")
(fps 9)
(images
"big_swim_down1.png"
"big_swim_down2.png"
"big_swim_down3.png"
"big_swim_down4.png"
"big_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "small-walking-left")
(fps 9)
(images
"big_swim_left1.png"
"big_swim_left2.png"
"big_swim_left3.png"
"big_swim_left4.png"
"big_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "small-walking-right")
(fps 9)
(mirror-action "small-walking-left")
)
(action
(hitbox 4 20 0 0)
(name "large-stop")
(images
"tux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "large-walking-up")
(fps 9)
(images
"big_swim_up1.png"
"big_swim_up2.png"
"big_swim_up3.png"
"big_swim_up4.png"
"big_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "large-walking-down")
(fps 9)
(images
"big_swim_down1.png"
"big_swim_down2.png"
"big_swim_down3.png"
"big_swim_down4.png"
"big_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "large-walking-left")
(fps 9)
(images
"big_swim_left1.png"
"big_swim_left2.png"
"big_swim_left3.png"
"big_swim_left4.png"
"big_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "large-walking-right")
(fps 9)
(mirror-action "large-walking-left")
)
(action
(hitbox 4 20 0 0)
(name "air-stop")
(images
"airtux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "air-walking-up")
(fps 9)
(images
"air_swim_up1.png"
"air_swim_up2.png"
"air_swim_up3.png"
"air_swim_up4.png"
"air_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "air-walking-down")
(fps 9)
(images
"air_swim_down1.png"
"air_swim_down2.png"
"air_swim_down3.png"
"air_swim_down4.png"
"air_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "air-walking-left")
(fps 9)
(images
"air_swim_left1.png"
"air_swim_left2.png"
"air_swim_left3.png"
"air_swim_left4.png"
"air_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "air-walking-right")
(fps 9)
(mirror-action "air-walking-left")
)
(action
(hitbox 4 20 0 0)
(name "fire-stop")
(images
"firetux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "fire-walking-up")
(fps 9)
(images
"fire_swim_up1.png"
"fire_swim_up2.png"
"fire_swim_up3.png"
"fire_swim_up4.png"
"fire_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "fire-walking-down")
(fps 9)
(images
"fire_swim_down1.png"
"fire_swim_down2.png"
"fire_swim_down3.png"
"fire_swim_down4.png"
"fire_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "fire-walking-left")
(fps 9)
(images
"fire_swim_left1.png"
"fire_swim_left2.png"
"fire_swim_left3.png"
"fire_swim_left4.png"
"fire_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "fire-walking-right")
(fps 9)
(mirror-action "fire-walking-left")
)
(action
(hitbox 4 20 0 0)
(name "ice-stop")
(images
"icetux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "ice-walking-up")
(fps 9)
(images
"ice_swim_up1.png"
"ice_swim_up2.png"
"ice_swim_up3.png"
"ice_swim_up4.png"
"ice_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "ice-walking-down")
(fps 9)
(images
"ice_swim_down1.png"
"ice_swim_down2.png"
"ice_swim_down3.png"
"ice_swim_down4.png"
"ice_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "ice-walking-left")
(fps 9)
(images
"ice_swim_left1.png"
"ice_swim_left2.png"
"ice_swim_left3.png"
"ice_swim_left4.png"
"ice_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "ice-walking-right")
(fps 9)
(mirror-action "ice-walking-left")
)
(action
(hitbox 4 20 0 0)
(name "earth-stop")
(fps 4)
(images
"earthtux.png"
)
)
(action
(hitbox 4 0 0 0)
(name "earth-walking-up")
(fps 9)
(images
"earth_swim_up1.png"
"earth_swim_up2.png"
"earth_swim_up3.png"
"earth_swim_up4.png"
"earth_swim_up5.png"
)
)
(action
(hitbox 4 0 0 0)
(name "earth-walking-down")
(fps 9)
(images
"earth_swim_down1.png"
"earth_swim_down2.png"
"earth_swim_down3.png"
"earth_swim_down4.png"
"earth_swim_down5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "earth-walking-left")
(fps 9)
(images
"earth_swim_left1.png"
"earth_swim_left2.png"
"earth_swim_left3.png"
"earth_swim_left4.png"
"earth_swim_left5.png"
)
)
(action
(hitbox 4 4 0 0)
(name "earth-walking-right")
(fps 9)
(mirror-action "earth-walking-left")
)
)
49 changes: 48 additions & 1 deletion src/worldmap/tux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,27 @@ Tux::draw(DrawingContext& context)
std::string action = get_action_prefix_for_bonus(m_worldmap->get_savegame().get_player_status().bonus);
if (!action.empty())
{
m_sprite->set_action(m_moving ? action + "-walking" : action + "-stop");
if (m_moving && (get_axis().x || get_axis().y))
{
if(m_worldmap->get_savegame().get_player_status().worldmap_sprite == "/images/worldmap/common/swim.sprite")
{
std::string direct = "-up";
if (get_axis().x == 1) direct = "-right";
if (get_axis().x == -1) direct = "-left";
if (get_axis().y == 1) direct = "-up";
if (get_axis().y == -1) direct = "-down";

m_sprite->set_action(action + "-walking" + direct);
}
else
{
m_sprite->set_action(action + "-walking");
}
}
else
{
m_sprite->set_action(action + "-stop");
}
}
else
{
Expand Down Expand Up @@ -114,6 +134,33 @@ Tux::get_pos() const
return Vector(x, y);
}

Vector
Tux::get_axis() const
{
int x = 0;
int y = 0;

switch (m_direction)
{
case Direction::WEST:
x = -1;
break;
case Direction::EAST:
x = 1;
break;
case Direction::NORTH:
y = 1;
break;
case Direction::SOUTH:
y = -1;
break;
case Direction::NONE:
break;
}

return Vector(x, y);
}

void
Tux::stop()
{
Expand Down
1 change: 1 addition & 0 deletions src/worldmap/tux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Tux final : public GameObject

bool is_moving() const { return m_moving; }
Vector get_pos() const;
Vector get_axis() const;
Vector get_tile_pos() const { return m_tile_pos; }
void set_tile_pos(const Vector& p) { m_tile_pos = p; }

Expand Down