Kind of lost with "spawn"


#1

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?


#2

It is the event that triggers the function.


#3

Thanks

What does the event spawn means? When in appears?


#4

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


#5

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

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