変数を使うことで、ほかのスプライト連携して動作をさせることができます。
変数が0の時は、バッターが立っている状態。1の時はボールが打ちあがって状態、という感じで
変数を切り替えることで、各スプライトの処理を変更することができるのです。
変数をたくさん作ると複雑になるので、ルールは作っておく必要がありますね。
By using variables, you can coordinate the behavior of multiple sprites.
For example, when the variable is set to 0, it represents a state in which the batter is standing. When it is set to 1., it indicates that the balll has been hit and is rising.
By switching the value of the variable, you can change howeach sprite behaves.
However,using too many variables can make the system complex, so it is important to establish clear rules for managing them.
次回