Tutorial 7: Actions, Arrays, Timers
I thought I already learned how to use Actions and arrays
But this section involves those skills, and also the new skill, timers
What's a timer?
A timer is basically a clock, that ticks, when it reaches each step the next action happens for example: We will take a watch as an example, a watch ticks for 60 seconds, the second hand moves each second, then after 60 seconds, the minute hand moves one, the hour hand also moves 1/60th of the way to the next hour every time
How would I go about making a Timer?
1.Bring down the console by pressing F11
2.Create a modifiable variable, for counting, like, Scene.count
3.Assign your new variable to 0, like, Scene.count = 0
4.Create a variable (modifiable or not, I like modifiable better), like, Scene.step
5.Assign your new variable to the amount of ticks you want it to do, 500 ticks is about 7 seconds, like, Scene.step = 500
6.Create an action array, with each step having some way of increasing your first variable, (Scene.count), like {Scene.count = Scene.count + 1}.
7.Assign Sim.timeFactor to a pointer type of view, which includes, your actions, your first variable / your second variable (if you don't know what / means, its divided), a call operator (()) and a reset back to 1, like, Sim.timeFactor = {Scene.Actions (Scene.count / Scene.step)();1;}
8.Your action should happen every tick.
That was difficult
It will get easier when you learn how to do everything involved better
No hay comentarios:
Publicar un comentario