|
The text below is a written version of the video above, choose whichever you find easier to follow.
Extra note: If you experience errors after copying the codes highlighted yellow it may be because the indents of the text get published as spaces instead of tabs, you will need to delete all of these spaces and indent it properly in your text editor.
=== TUTORIAL #2 ===
Common Commands
— Step 1: Learn common parameters and tweens
You know how to change parameters and you have learned the sleep tween from the previous tutorial.
Here are some of the more common ones you’ll come to use.
Parameter:
addx,200; adds to the file’s current X coordinate, the example will add 200 to whatever the coordinate was previously.
addy,300; adds to the file’s current Y coordinate, the example will add 300 to whatever the coordinate was previously.
diffusealpha,0.5; changes the file’s opacity where 1 is Opaque and 0 is Transparent, example demonstrates 50% transparent.
zoom,2; stretches the image, the example makes the image twice as big.
rotationz,30; rotates the file along the Z axis (screen), the example rotates the file to 30 degrees.
rotationy,180; rotates the file along the Y axis, the example flips the file horizontally
rotationx,180; rotates the file along the X axis, the example flips the file vertically
Tween:
linear,2; sets a transition between the first parameters set, and the parameters set afterward, the example has a 2 second transition.
accelerate,2; sets a slow to fast transition between the first parameters set, and the parameters set afterward, the example has a 2 second transition.
decelerate,2; sets a fast to slow transition between the first parameters set, and the parameters set afterward, the example has a 2 second transition.
— Step 2: Using Tweens
Think of a Tween like a transition between point A and point B over a certain period of time, all parameters set before a tween get changed to new values gradually if you set them again after the tween.
Continuing on from the example in the previous tutorial, we are going to clear the command.
<Layer
File="nyan.png"
InitCommand=""
/>
The first thing you should do is make a note of the effect you hope to achieve, using nyan cat I know that I need to have my file scroll across the screen.
This example starts the File’s X coordinate at 900, Y coordinate at 240, then it has a linear transition of 5 seconds before reaching its end point at X coordinate of -900 after taking 1800 from the starting X coordinate.
<Layer
File="nyan.png"
InitCommand="x,900;y,240;linear,5;addx,-1800;"
/>
But let’s say I want nyan cat to arc upwards and rotate a bit instead, but also gradually build speed…
This example starts the File’s X coordinate at 900, Y coordinate at 240, then it has a linear transition of 5 seconds before reaching its end point at X of -900, Y of 100 and a new rotation of 10 degrees.
<Layer
File="nyan.png"
InitCommand="x,900;y,240;accelerate,5;addx,-1800;rotationz,20;addy,-140;"
/>
Maybe I instead want to make nyan cat slow down gradually, shrink and disappear too.
This example does exactly that, try seeing if you can follow what happens.
<Layer
File="nyan.png"
InitCommand="x,900;y,240;decelerate,5;addx,-1800;rotationz,20;addy,-140;zoom,0.1;diffusealpha,0;"
/>
Stepmania and OpenITG will allow you to place up to 52 of these entries into a single command, the last example contained 8.
If you ever find that you are running out you can use playcommand.
This example does exactly the same thing except it is cut into 2 different commands, you have the freedom to name these commands however you wish so long as they aren’t global commands such as On, Off and Init.
<Layer
File="nyan.png"
InitCommand="x,900;y,240;playcommand,NyanSmash;"
NyanSmashCommand="decelerate,5;addx,-1800;rotationz,20;addy,-140;zoom,0.1;diffusealpha,0;"
/>
— Step 3: Do the same with ActorFrames
You can do the same commands inside an actorframe too, referring back to the last tutorial an actorframe is like a box that contains all of your files, therefore running a command on an actorframe will affect every file within it.
The below example will zoom everything to 5-times their original sizes over the period of 5 seconds, this is semi-countered by the fact that the file’s command is gradually making it shrink.
<ActorFrame InitCommand="linear,5;zoom,5;">
<children>
<Layer
File="nyan.png"
InitCommand="x,900;y,240;playcommand,NyanSmash;"
NyanSmashCommand="decelerate,5;addx,-1800;rotationz,20;addy,-140;zoom,0.1;diffusealpha,0;"
/>
</children>
</ActorFrame>
By now you will have the knowledge to perform basic movements and actions.
Tune in next time to learn how to incorporate animated sprites.
|