flare-engine icon indicating copy to clipboard operation
flare-engine copied to clipboard

Possible optional feature: falling into pits?

Open clintbellanger opened this issue 9 years ago • 2 comments

In TIled, we have maps with meta tile types of Void, Wall, Floor, Pit. These are mainly used for Automapping.

Pits are areas where the player can't walk, but flying objects and enemies can cross it. We use it for water in the grasslands and caverns, and the dark drop off pits in the dungeons.

I'm interested in an optional feature to allow falling into pits.

My dream features for this:

  • Add engine level config-file option to enable falling-into-pits. This is true/false.
  • Add engine level config-file option for gravity constant. This is a floating point number, units of pixels per frame per frame
  • If this is enabled, remove collision on pits.
  • If a non-flying player or enemy is standing on a pit, change their state to Falling.
  • Give statblock position a z coordinate, default 0, currently only used for this feature.
  • Give statblock position a falling_speed (or delta_z, speed_z, etc).
  • In the Falling state, apply gravity
  • When preparing a sprite renderable, add z-position to the final screen y value
  • Doesn't change map draw position or order
  • When the falling entity has left the bottom of the screen, trigger an outcome
  • Enemies die
  • Hero usually dies, unless a map option (or event-trigger option?) has been set.
  • Add an option to maps called pit_map={theMapUnderneathThisOne.txt).
  • Assume the coordinates of these two maps line up.
  • If the options have been set, the player teleports to the pit map instead of dying.
  • Warping to pit map, set the player's Z-coordinate so they are off the top of the screen. Reset their falling speed.
  • Let gravity take the player back down to z=0, they land on the ground
  • Put the avatar in Stance (or maybe Hit) state, and give control back to the player on this new map.
  • Does falling state get its own animation? Even if we just plug in the stance animation file most of the time
  • Does falling state get a sound effect from player or enemies?

Thanks! I want to use the knockback feature to get some pushing stuff off of ledges action.

clintbellanger avatar Jun 23 '16 04:06 clintbellanger

Unfortunately, we also use the "pit" collision tile for small objects, such as rocks, tree stumps, and treasure chests. We would need to add new collision tiles to distinguish between these two. What is referred to as "Pit" now in automapping would become "Low Wall". Then the new automapping tile would be "Pit".

dorkster avatar Jun 23 '16 12:06 dorkster

That's true. I'll try separating those two in the new tilesets I'm messing with, so we have test data to use. Will post back here later when that's ready.

clintbellanger avatar Jun 23 '16 20:06 clintbellanger