This is a super janky trigger system I threw together. It's not the best XD. Activators always "Act" on their immediate parent in the Node tree. So whatever you want turned on needs to be the parent. (notably useful for the FallingComponent).
- Proximity Activator
- This one follows Area2D rules, set editable children to set up the collider. I can't have a collider set up by default because then all Proximity Activators end up sharing a hitbox
- Timer Activator
- Activates traps periodically regardless of situation. You can set 3 times in the exports.
- Contact Activator
- This one's like the proximity activator except you give it a "Body" export and it activates whenever that body is touched physically by the player.
- Falling Blocks
- Shooty Blocks
- Hidden Spikes
- structure:
- CharacterBody2D as the base node
- FallingComponent (this is where you set falling speed)
- ContactActivator (you MUST set the "body" export equal to your base CharacterBody, sorry)
- CollisionShape
- Sprite
- etc.
- FallingComponent (this is where you set falling speed)
- CharacterBody2D as the base node
- When building a falling block you have to make sure it's sides are at least 1 pixel less than flush with surrounding tiles. Easiest way is to set collider size = 128 * [tiles] - 1
- You can make a falling block fall through terrain by setting it's mask to not include the "Walls" layer. (If you want it to crush the player it may still need the player layer)
- Instead of having a Contact Activator you can use a Proximity Activator and have blocks fall based on where the player is nearby:
- CharacterBody2D as the base node
- FallingComponent (this is where you set falling speed)
- Proximity Activator (Remember to use "Editable Children" to edit the collision shape)
- CollisionShape
- Sprite
- etc.
- FallingComponent (this is where you set falling speed)
- With this you can also stick a "Death" hitbox somewhere in there and make it extra deadly!. (actual crushing coming soon(tm))
- CharacterBody2D as the base node
- Pretty similar to Falling Blocks 👆
- structure:
- Base Node (can be any node 2d, probably a static body most o' the time)
ProjectileShooterComponent
(Positioned at the projectile spawn point, Has a "prototype" export that has to be set)- Whatever projectile this will shoot (Must be a
Projectile
node, Must be set as the "Projectile Prototype" in theProjectileShooterComponent
) - Any Activator node (See Falling Blocks)
- Whatever projectile this will shoot (Must be a
- Base Node (can be any node 2d, probably a static body most o' the time)
- Pretty(ish) similar to other components, Rotating devices will rotate the component's parent.
- There's a secondary function to this one 'cause I'm rushing, where rotating devices will center the "Snap Target" export.
- One thing that you should think about with RotationComponents is that you really don't want to rotate physics objects for stuff like blocks (it'll mess with the player collision if you're touching the block.)
- To solve this you can attach the rotation component to a Node2D container that just has the bits you want to spin inside.