flare icon indicating copy to clipboard operation
flare copied to clipboard

Traps

Open clintbellanger opened this issue 12 years ago • 7 comments

I want to start implementing traps in Flare. I'm looking for ideas for traps and how they might look using the current implementation of events + powers.

Example 1: Classic pressure plate arrow trap

In the dungeon tile set, use one of the offset looking flagstone tiles. Create an event on that square. When the player steps on that square play a click sound, change the tile to a flat one, and spawn an arrow that shoots at the hero. It can be a run_once event.

Example 2: Spiked floor trap

Perhaps use these over dungeon grates. Create an event on a specific square. When the player steps on that square, a new hazard with spikes animation occurs. Instead of run_once, put a delay on it so that it can occur again a few seconds later. As far as I know this can be done currently, if I create the art for it. If the spikes are only active at their topmost frame it could give players a tiny moment to trigger then dodge the trap.

Example 3: Pendulum blade trap

Imagine a swinging pendulum that is safe at the top of its swing but is dangerous at the bottom. Let's say this pendulum swings in a 4x1 tile area. There are several tricky parts here that I'm not sure our current system can handle:

  • The affected area should be a thin rectangle, not a circle as all hazards currently use. (Add rectangle vs. circle collision shapes)
  • Should it be dangerous ("active") for several frames, or just the bottom-most frame? (which seems to work fine for melee swings).
  • The animation goes back and forth, but in the full animation there would be two active attack frames (one going, one returning). Right now hazards are either dangerous their entire time or dangerous on one specific frame. Maybe active frames needs to be a list instead of a single number?
  • How would the trap start? e.g. if these are in a hallway, we could make it so that they trigger on a floor event at the mouth of the hall. Or we could add a new event type that executes when the map is loaded.

Example 4: Saw blades that move long distances

Unlike the Pendulum which is basically not moving location, a saw blade in the floor might move all the way across a room and come back once it hits a wall. It is hazardous the entire time. Maybe this can be done in a simple way by allowing moving powers to reflect off walls? Then this could be a missile type that doesn't go away when it hits a target.

I'd like a Metal Elemental boss that casts these. Imagine if you had to kill the boss before the room was just too full of saw blades to survive.

Example 5: Flame Jets

These could go off at intervals automatically or trigger from a pressure plate.

Example 6: Caltrops

These could be a power with a long lifetime that sit on the floor, and cause damage + slow when stepped on. We might give this power to enemies or the player (either as a ranger type Power or a consumable item).

Example 7: Bear Trap

Similar to Caltrops, this one would would have an after effect power to show the closed trap for a few seconds. I think this would work anyway. This one would immobilize instead of slow. We could have the player or creatures drop these as well.

Example 8: Sphere of Annihilation

Touch it and you die.


What other classic trap types could we add, and how might they be implemented?

For some of these traps, it would be neat if they could be disabled by the player. What if you got close to an Arrow Pressure Plate and clicked on the tile, and the arrow would sail by harmlessly? What if on the other end of a Pendulum Hallway there's a switch you can throw to turn them off?

clintbellanger avatar Jul 12 '12 16:07 clintbellanger

So right now, I've got this working in a completely roundabout way by making an enemy, platetrap.txt or something similar with speed/dspeed=0, avoidance=100 which just unleashes a Quake power or something similar to damage the player when they get close. It's a little shoddy right now, as I can't seem to get the timing quite right. Not sure how one would go about disarming that.

makrohn avatar Jul 12 '12 20:07 makrohn

makrohn, It's also possible to use map events to spawn powers directly.

See: https://github.com/clintbellanger/flare/blob/master/mods/living_bones/maps/brothers_lair_fire_hall.txt#L306

pennomi avatar Jul 12 '12 20:07 pennomi

Ah! Clutch.

makrohn avatar Jul 12 '12 21:07 makrohn

As mentioned in commit f223038 I've added some new logic to map event powers:

  • If an event power doesn't specify a power_path, it assumes the source and target are the event's location.
  • Moved event power locations to tile centers
  • Event powers cool down even when the hero is not in range (inside the map's logic() routine).

I've created floor spike traps. Here's an example of how they look in plain text:

[event]
# floor spikes
location=24,81,1,1 
power=160
power_damage=10,15
power_cooldown=90
hotspot=-32,-16,64,32

Here they're on tile 24,81 (I was testing with Ancient Temple). Power damage must be specified (that's fine, makes the power reusable).

Note there's a hotspot. If the player clicks on the trap square he can trigger the trap, then safely move past it (well, power_cooldown gives him 3 seconds to do so).

You'd want one of these events per trapped tiled. Because location is based on Tiled's object position, it's easy to copy/paste these traps.

clintbellanger avatar Jul 16 '12 07:07 clintbellanger

Updates from 93f49c1ce2

  • power_cooldown is now just "cooldown" and applies to the entire event

I uploaded the ancient temple exported file (spike traps in the northwest room). I also updated the existing traps in the Averguard and Living Bones mods.

clintbellanger avatar Jul 16 '12 16:07 clintbellanger

I noticed that an empty tooltip appears when you hover the spikes trap in Ancient Temple. Maybe it would be better to not render the tooltip at all? Or specify correct tooltip in frontier/maps/ancient_temple.txt?

ghost avatar Aug 27 '12 10:08 ghost

Looks like an oversight in some recent refactoring. If an event has a Hotspot but no Tooltip, the tooltip should not be displayed. This allows for "secret" clickable events like these traps.

clintbellanger avatar Aug 27 '12 11:08 clintbellanger

@clintbellanger Do we support this fully? Or there is still some TODO?

igorko avatar Jan 27 '14 14:01 igorko