Basically I have a cube item in my scene, and another script tracking correct and incorrect guesses. Been following a lot of guides to get to this point, so I feel kind of in the dark.
Anyway, I want the cube to shake each time the player inputs an incorrect guess. Anyone got tips on how to do that? Where should I start looking?
the script and animation are attached to the shaking item, the thing that should trigger the shaking is elsewhere (i canât attach it to the shaking item, not without a lot of code restructuring â hoping to avoid that)
Referencing variables, fields, methods (anything non-static) in other script instances:
REMEMBER: it isnât always the best idea for everything to access everything else all over the place. For instance, it is not great for the player to reach into an enemy and reduce his health.
Instead there should be a function you call on the enemy to reduce his health. All the same rules apply for the above steps: the function must be public AND you need a reference to the class instance.
That way the enemy (and only the enemy) has code to reduce his health and simultaneously do anything else, such as kill him or make him reel from the impact, and all that code is centralized in one place.