Skip to content

Commit

Permalink
Root Sapling (a.k.a. Corrupted Mole) (#2698)
Browse files Browse the repository at this point in the history
* Initial sprites for Root Sapling [ci skip]

Note: The sprites of the Root Sapling itself are still WIP and mostly serve to begin coding!

* Update root_attack.sprite [ci skip]

* Delete data/images/creatures/mole/corrupted/root_base.sprite [ci skip]

* Rename root_attack.sprite to root.sprite [ci skip]

* wip root sapling

* root sapling basic behaviour

* Particles, fine tuning, and death

* summon roots on different ground levels

* Add root to game object factory

* Root will only kill COLGROUP_MOVING objects

* Add glow sprites for the Root Sapling's core [ci skip]

* Glowing root sapling

* Root sapling do not spawn in thin platforms

* Update objects.stoi [ci skip]

* Adjustments

* remove unused variables

* construct function + wip support all directions

* aeiou

* Support for down + actions for all sides

* horizontal textures

* all sides!!!!!

* hit down facing saplings

* Update Root Sapling sprites [ci skip]

Light sprites still needs position adjustments!

* Preparing for crusher new roots

* fixes

* Revert is_free_of_tiles and fix detection

- Fix solid tilemap issue
- Fix spawning thru unisolid tiles

* fix more bugs

* picky compiler

* oops

* fix layers and bottom root sapling spawning even when not full

* whoops

* moving tilemaps are stupid

* fix warnings

* Fix get_action_surfaces warning

* Fix summon check when theres a moving tilemap

* fix the fixes

* Fix down/right not choosing the right position

Please let this be the last bug

* remove todo [ci skip]

* Give Mole bigger hill size [ci skip]

Also, increase rock size + one more sprite variant
(needs code adjustments!)

* random mole rock & mole bounce on squish

* Code style fixes

* support multiple players

* mole is snipable

* Replace `return` with `continue`

* fix down root sapling

* bonk on down root sapling inverts velocity

* faster root sapling

---------

Co-authored-by: MatusGuy <[email protected]>
Co-authored-by: Vankata453 <[email protected]>
  • Loading branch information
3 people authored Mar 29, 2024
1 parent 3bd8395 commit c2cc19b
Show file tree
Hide file tree
Showing 93 changed files with 981 additions and 90 deletions.
Binary file modified data/images/creatures/mole/center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions data/images/creatures/mole/corrupted/core_glow/core_glow.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(supertux-sprite
(action
(name "default")
(hitbox 183 193 350 350)
(fps 12)
(images "core_glow-0.png"
"core_glow-1.png"
"core_glow-2.png"
"core_glow-3.png"
"core_glow-4.png"
"core_glow-5.png"
"core_glow-6.png"
"core_glow-7.png"
"core_glow-8.png"
"core_glow-9.png"
"core_glow-10.png"
"core_glow-9.png"
"core_glow-8.png"
"core_glow-7.png"
"core_glow-6.png"
"core_glow-5.png"
"core_glow-4.png"
"core_glow-3.png"
"core_glow-2.png"
"core_glow-1.png")
)
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions data/images/creatures/mole/corrupted/root.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(supertux-sprite
(action
(name "root")
(hitbox 20 7 16 80)
(images "root_attack.png"))

(action
(name "root-up")
(hitbox 20 7 16 80)
(clone-action "root"))
(action
(name "base-up")
(hitbox 20 7 16 80)
(images "root_base.png"))

(action
(name "root-down")
(hitbox 20 9 16 80)
(flip-action "root-up"))
(action
(name "base-down")
(hitbox 20 9 16 80)
(flip-action "base-up"))

(action
(name "root-left")
(hitbox 7 22 80 16)
(images "root_attack_left.png"))
(action
(name "base-left")
(hitbox 7 22 80 16)
(images "root_base_left.png"))

(action
(name "root-right")
(hitbox 9 22 80 16)
(mirror-action "root-left"))
(action
(name "base-right")
(hitbox 9 22 80 16)
(mirror-action "base-left"))
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions data/images/creatures/mole/corrupted/root_sapling.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
(supertux-sprite
(action
(name "idle")
(hitbox 24 22 32 32)
(fps 8)
(images "root_sapling-0.png"
"root_sapling-1.png"
"root_sapling-2.png"
"root_sapling-3.png"
"root_sapling-4.png"
"root_sapling-5.png"
"root_sapling-6.png"
"root_sapling-7.png"
"root_sapling-8.png"
"root_sapling-9.png"
"root_sapling-10.png"
"root_sapling-11.png"
)
)
(action
(name "idle-up")
(fps 8)
(hitbox 24 22 32 32)
(clone-action "idle")
)
(action
(name "squished-up")
(fps 15)
(loops 1)
(hitbox 24 22 32 32)
(images "corrupted_hill-0.png"
"corrupted_hill-1.png"
"corrupted_hill-2.png"
"corrupted_hill-3.png"
"corrupted_hill-3.png"
"corrupted_hill-4.png"
)
)
(action
(name "idle-down")
(fps 8)
(hitbox 24 70 32 32)
(flip-action "idle-up")
)
(action
(name "squished-down")
(fps 15)
(loops 1)
(hitbox 24 70 32 32)
(flip-action "squished-up")
)
(action
(name "idle-left")
(hitbox 18 24 32 32)
(fps 8)
(images "root_sapling-0_left.png"
"root_sapling-1_left.png"
"root_sapling-2_left.png"
"root_sapling-3_left.png"
"root_sapling-4_left.png"
"root_sapling-5_left.png"
"root_sapling-6_left.png"
"root_sapling-7_left.png"
"root_sapling-8_left.png"
"root_sapling-9_left.png"
"root_sapling-10_left.png"
"root_sapling-11_left.png"
)
)
(action
(name "squished-left")
(fps 15)
(loops 1)
(hitbox 18 24 32 32)
(images "corrupted_hill-0_left.png"
"corrupted_hill-1_left.png"
"corrupted_hill-2_left.png"
"corrupted_hill-3_left.png"
"corrupted_hill-3_left.png"
"corrupted_hill-4_left.png"
)
)
(action
(name "idle-right")
(hitbox 70 24 32 32)
(fps 8)
(mirror-action "idle-left")
)
(action
(name "squished-right")
(fps 15)
(loops 1)
(hitbox 70 24 32 32)
(mirror-action "squished-left")
)
)
Binary file modified data/images/creatures/mole/down-0.png
Binary file modified data/images/creatures/mole/down-1.png
Binary file modified data/images/creatures/mole/down-2.png
11 changes: 6 additions & 5 deletions data/images/creatures/mole/mole.sprite
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(supertux-sprite
(action
(name "idle")
(hitbox 18 22 32 40)
(hitbox 26 22 32 64)
(fps 12)
(images "mole_hill.png"
)
)
(action
(name "peeking")
(hitbox 18 22 32 40)
(hitbox 26 22 32 40)
(fps 12)
(images "mole_hill.png"
"up-0.png"
Expand Down Expand Up @@ -44,7 +44,7 @@
)
(action
(name "burning")
(hitbox 18 22 32 40)
(hitbox 26 22 32 64)
(fps 15)
(loops 1)
(images "mole_hill.png"
Expand All @@ -54,8 +54,9 @@
(name "squished")
(fps 12)
(loops 1)
(hitbox 18 22 32 40)
(images "down-0.png"
(hitbox 26 22 32 64)
(images "up-3.png"
"down-0.png"
"down-1.png"
"down-2.png"
"mole_hill.png"
Expand Down
Binary file modified data/images/creatures/mole/mole_hill.png
Binary file modified data/images/creatures/mole/mole_rock-0.png
Binary file modified data/images/creatures/mole/mole_rock-1.png
Binary file added data/images/creatures/mole/mole_rock-2.png
16 changes: 12 additions & 4 deletions data/images/creatures/mole/mole_rock.sprite
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
(supertux-sprite
(action
(name "medium")
(hitbox 0 0 13 12)
(name "variant-1")
(hitbox 5 6 15 15)
(images
"mole_rock-0.png"
)
)

(action
(name "small")
(hitbox 0 0 10 10)
(name "variant-2")
(hitbox 5 6 15 15)
(images
"mole_rock-1.png"
)
)

(action
(name "variant-3")
(hitbox 8 8 11 11)
(images
"mole_rock-2.png"
)
)
)
Binary file modified data/images/creatures/mole/peek_left-0.png
Binary file modified data/images/creatures/mole/peek_left-1.png
Binary file modified data/images/creatures/mole/peek_left-2.png
Binary file modified data/images/creatures/mole/peek_right-0.png
Binary file modified data/images/creatures/mole/peek_right-1.png
Binary file modified data/images/creatures/mole/peek_right-2.png
Binary file modified data/images/creatures/mole/up-0.png
Binary file modified data/images/creatures/mole/up-1.png
Binary file modified data/images/creatures/mole/up-2.png
Binary file modified data/images/creatures/mole/up-3.png
5 changes: 4 additions & 1 deletion data/images/engine/editor/objects.stoi
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
(object
(class "darttrap")
(icon "images/creatures/darttrap/granito/empty_left.png"))
(object
(object
(class "root_sapling")
(icon "images/creatures/mole/corrupted/root_sapling-0.png"))
(object
(class "ghoul")
(icon "images/creatures/ghoul/g1.png"))
(object
Expand Down
Binary file added data/images/particles/corrupted_rock-0.png
Binary file added data/images/particles/corrupted_rock-1.png
Binary file added data/images/particles/corrupted_rock-2.png
Binary file added data/images/particles/corrupted_rock-3.png
Binary file added data/images/particles/corrupted_rock-4.png
41 changes: 41 additions & 0 deletions data/images/particles/corrupted_rock.sprite
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(supertux-sprite
(action
(name "piece-0")
(hitbox 0 0 8 8)
(images
"corrupted_rock-0.png"
)
)

(action
(name "piece-1")
(hitbox 0 0 10 10)
(images
"corrupted_rock-1.png"
)
)

(action
(name "piece-2")
(hitbox 0 0 16 16)
(images
"corrupted_rock-2.png"
)
)

(action
(name "piece-3")
(hitbox 0 0 8 8)
(images
"corrupted_rock-3.png"
)
)

(action
(name "piece-4")
(hitbox 0 0 10 10)
(images
"corrupted_rock-4.png"
)
)
)
7 changes: 4 additions & 3 deletions src/badguy/ghosttree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
#include "supertux/sector.hpp"

static const size_t WILLOWISP_COUNT = 10;
static const float ROOT_TOP_OFFSET = 64;
static const float WILLOWISP_TOP_OFFSET = -64;
static const Vector SUCK_TARGET_OFFSET = Vector(-16,-16);
static const float SUCK_TARGET_SPREAD = 8;
static const float ROOT_HEIGHT = 87;

GhostTree::GhostTree(const ReaderMapping& mapping) :
BadGuy(mapping, "images/creatures/ghosttree/ghosttree.sprite", LAYER_OBJECTS - 10),
Expand Down Expand Up @@ -154,12 +152,15 @@ GhostTree::active_update(float /*dt_sec*/)
}
}

// TODO: Add support for the new root implementation
/*
if (root_timer.check()) {
/* TODO: indicate root with an animation. */
//TODO: indicate root with an animation.
auto player = get_nearest_player();
if (player)
Sector::get().add<Root>(Vector(player->get_bbox().get_left(), (m_flip == NO_FLIP ? (m_col.m_bbox.get_bottom() + ROOT_TOP_OFFSET) : (m_col.m_bbox.get_top() - ROOT_TOP_OFFSET - ROOT_HEIGHT))), m_flip);
}
*/
} else if (mystate == STATE_SWALLOWING) {
if (suck_lantern) {
// Suck in the lantern.
Expand Down
7 changes: 6 additions & 1 deletion src/badguy/mole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "badguy/mole_rock.hpp"
#include "math/random.hpp"
#include "math/util.hpp"
#include "object/player.hpp"
#include "sprite/sprite.hpp"
#include "supertux/flip_level_transformer.hpp"
#include "supertux/sector.hpp"
Expand Down Expand Up @@ -64,9 +65,13 @@ Mole::collision_badguy(BadGuy& , const CollisionHit& )
}

bool
Mole::collision_squished(GameObject& )
Mole::collision_squished(GameObject& obj)
{
set_state(DEAD);

if (auto player = dynamic_cast<Player*>(&obj))
player->bounce(*this);

SoundManager::current()->play("sounds/squish.wav", get_pos());
run_dead_script();
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/badguy/mole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class Mole final : public BadGuy
static std::string display_name() { return _("Mole"); }
virtual std::string get_display_name() const override { return display_name(); }

virtual bool is_snipable() const override { return true; }

virtual void on_flip(float height) override;

protected:
Expand Down
4 changes: 2 additions & 2 deletions src/badguy/mole_rock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ MoleRock::initialize()
{
m_physic.set_velocity(initial_velocity);

// Randomly select a rock size to display.
set_action(graphicsRandom.rand(2) == 0 ? "small" : "medium");
int num = graphicsRandom.rand(1, static_cast<int>(m_sprite->get_actions_count()) + 1);
set_action("variant-" + std::to_string(num));
}

void
Expand Down
Loading

0 comments on commit c2cc19b

Please sign in to comment.