I am a beginner in JavaScript and gamemaking. I have two questions.
How do I make a particle trail follow a collided object?
This script instantiates a particle system when a target object is collided with a bullet
but the trail does not follow the target. The particle system is a child of the target object,
so it seems that it should follow the target, but it just keeps emitting for a few seconds in one spot.
How do I make a game go into Pause by hitting the “P” keystroke?
The pause script goes into any behavior attached to an object, inside an Update() function. Since Input and Time are both classes which are accessed globally, it makes no difference what script those lines are stuck in, as long as it’s attached to an object (and only one object!).
There’s no need to assign buttons if using GetKey (although you’re correct about using a lowercase p - my bad). It’s also true that a more “proper” way would be to use Input.GetButtonDown(“Pause”) instead, and assign a pause key in the input manager. GetKey is just the quick n dirty method.