Author Topic: New Event System  (Read 2438 times)

A lightswitch would go something like this:

Code: [Select]
0) Enabled -> onActivate -> Named Brick (Light) -> SetLight -> Player Light
1) Disabled -> onActivate -> Named Brick (Light) -> SetLight -> None
2) Enabled -> onActivate -> Self -> ToggleEventEnabled -> 0
3) Enabled -> onActivate -> Self -> ToggleEventEnabled -> 1

For those who understand this:

Quote from: Badspot on GarageGames
The event system works via a registered list of input and output events associated with each object class. For this iteration, the only thing that can take input events is the brick class. So the input events for bricks are things like onPlayerTouch, onProjectileHit, onActivate (player clicking it), etc. Then for each of those input events, there is a list of potential targets for outputs. For example, the onPlayerTouch input event has the player, the client who owns that player, and the brick that was touched all as potential targets. Then once you choose a target, you can choose to fire any output event that is associated with that target's class. For example the player class has output events like setVelocity, damage, setScale, respawn, etc.

So if you want to make a jump pad say, you select your brick and say onPlayerTouch->Player->addVelocity 0 0 10
If you want a collapsing bridge you say OnPlayerTouch->self (thats the brick you touched)-> fakeKill 5. The brick will break on contact and respawn 5 seconds later. You can also add a delay in there for a more interesting effect.

There's a bunch of stuff you can do and I'll probably have more detailed videos when I get closer to pushing this update out.