Skip to content

Commit

Permalink
chore: the cake is a lie
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Dec 21, 2024
1 parent 26da419 commit 9d475ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions guides/en/1_getting_started/6_events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ kat.on("hurt", () => {
## Custom events

Sometimes you will need create a custom event. For this, we use the `on()` and
`trigger()` functions.
`obj.trigger()` functions.

```js
// Eat event for all objects with candy tag
on("eat", "candy", () => {
debug.log("NOOOOO CANDY :(");
// Eat event for all objects with cake tag
on("eat", "cake", () => {
debug.log("The cake is a lie!");
});

onKeyPress("space", () => {
trigger("eat");
onKeyPress(() => {
obj.trigger("cake");
});
```

Expand Down

0 comments on commit 9d475ab

Please sign in to comment.