viernes, 20 de septiembre de 2013

Acciones, temporizadores, matrices, teclas

Tutorial 8: Final: Actions, Arrays, Timers, Keys I've learned all those things now, what is this tutorial for? You may have learned the tutorials, but you haven't put everything together yet. What do we plan to do here? We plan to turn on and off a timer using the key "a" BAH, but how can we do that? We are going to make a homemade toggle I created (its most likely been around for ages but nonetheless, I figured it out myself, so....) Var = ((Var * -1) + 1) this will make Var = 1 if its 0, and 0 if its 1 I think I know how its all going to go about, but can you show me anyway? Get the code from your previous timer, and put it in, but this time, we are going to do it a little differently. 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.Create a new modifiable variable, like, Scene.ToggleTimer 8.Create a new array, like, Scene.timeFactorA = [{1;}, {Scene.Actions (Scene.count / Scene.step)();1;}] 8.Assign Sim.timeFactor to an action pointer, 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, also in a 2 element array like, Sim.timeFactor = {Scene.timeFactorA Scene.ToggleTimer} 9.Bind a key to toggle (using Var = ((Var * -1) + 1) ), like, Keys.bind("a",{Scene.ToggleTimer = ((Scene.toggle * -1) + 1);}) 10.Check all the codes aren't visibly wrong. the toggle timer should be set up. Any examples? Yeah, there's a ragdoll battle (KAGE made it) Name: Coded ragdoll battle V2 File Size: 234.7KB

No hay comentarios:

Publicar un comentario