Kind of lost with "spawn"

Hi, I’m lost and not sure what does “spawn” does, here:

pet.on(“spawn”, Spawn) #where Spawn is a function

What “spawn” between “” does?

It is the event that triggers the function.

1 Like

Thanks

What does the event spawn means? When in appears?

1 Like

it just tells the pet : “sparky, when you spawn, do this function”, so “spawn” is the event, and Spawn is the name of the function, which you can change, but you can’t change the event, or it will give you an error

2 Likes

“spawn” is the trigger for the function Spawn that is defined somewhere else.

“spawn” is an event, just like “collide”.

3 Likes