Opacity
Custom fades are your friend--you can make a game look much more polished by adding custom fades to sprites instead of having them pop up and vanish. Here's a simple fade effect that occurs during one second. Alpha 0.0 is invisible and alpha 1.0 is opaque. "Linear" means seconds. We add "on show" and "on hide" to have effects for both.
Code: Select all
transform basicfade:
on show:
alpha 0.0
linear 1.0 alpha 1.0
on hide:
linear 1.0 alpha 0.0
Code: Select all
show eileen at basicfade, center
e "Here I am!"
e "Buh-bye now!"
hide elieen
Realistic Rain
Search for rain animation tutorials to find an easy way to make images. I used this tutorial for Gimp. I got a nice result using three frames. Define your image by indicating the images and the amount of time between each:
Code: Select all
image rain:
"rain.png"
0.1
"rain2.png"
0.1
"rain3.png"
0.1
repeat
Code: Select all
scene darksky
show house
show rain
Code: Select all
scene darksky
show rain
show bedroom
You can also build a layered image using LiveComposite (it ain't just for sprites).
Code: Select all
image bedroom:
LiveComposite((800,600), (0,0), "darksky", (0,0), "rain", (0,0), "bedroom.png")
Code: Select all
scene bedroom
You can take advantage of the Null command in animation loop to make an image flicker. It can create a neat effect on terminal-like objects and screens.
Code: Select all
image monitor:
"scanlines.png"
1.4
Null ()
0.05
"scanlines.png"
4.0
Null ()
0.05
repeat
This makes a little airplane go from the left to the right side of the screen over 45 seconds. Since I only used this effect once I included the position commands in the image definition, so you just type
Code: Select all
show airplane
Code: Select all
image airplane:
"airplane.png"
xalign -0.1 yalign 0.15
linear 45.0 xalign 1.1
Code: Select all
transform falling:
yalign 0.0 xalign 0.5
linear 1.0 yalign 1.0
Code: Select all
show ball at falling
Choice and Parallel - Adding Simultaneous and Random Elements
Randomized Lightning
This takes advantage of the choice command to use random images at random positions. Make three (or however many) lightning images, and define the image to show a random lighting picture using choice:
Code: Select all
image lightning:
choice:
"lightning.png"
choice:
"lightning2.png"
choice:
"lightning3.png"
Code: Select all
choice 3.0:
"lightning.png"
Code: Select all
transform flash:
parallel:
yalign 0.0
choice:
xalign 0.9
choice:
xalign 0.5
choice:
xalign 0.1
parallel:
alpha 0.0
linear 0.25 alpha 1.0
linear 0.25 alpha 0.0
Code: Select all
show lightning at flash
In Locked-In there is a scene where a waiter walks by a with a dinner tray. I made the tray move from right to left, AND slightly up and down to simulate walking, by splitting the y movement and the x movement into two parallel blocks.
Code: Select all
transform tray:
parallel:
xalign 2.5
linear 4.0 xalign -2.0
parallel:
yalign 1.5
block:
linear 1.0 yalign 1.0
linear 1.0 yalign 1.5
repeat
Analog Clock
For this you will need a separate clock face, minute hand, and hour hand. The hour hand rotates in 60 seconds and the minute hand rotates in 5 seconds. If you get a bad jitter effect on slow rotations you can add subpixel True to smooth things out.
Code: Select all
transform hoursforward:
subpixel True
rotate 0
linear 60.0 rotate 360
repeat
Code: Select all
transform minutesforward:
subpixel True
rotate 0
linear 5.0 rotate 360
repeat
Code: Select all
transform hoursbackward:
subpixel True
rotate 0
linear 60.0 rotate -360
repeat
This is how I made the padlock on the Locked-In logo swing back and forth before coming to a standstill. I use a block statement to separate the latter part of the transform.
Code: Select all
transform lock:
rotate 0
linear 0.0 rotate 30
block:
linear 0.75 rotate -30
linear 0.65 rotate 25
linear 0.60 rotate -25
linear 0.55 rotate 20
linear 0.50 rotate -20
linear 0.45 rotate 15
linear 0.35 rotate -15
linear 0.30 rotate 10
linear 0.25 rotate -10
linear 0.20 rotate 5
linear 0.15 rotate -5
linear 0.1 rotate 0
Code: Select all
transform lock:
rotate 0
linear 0.0 rotate 30
block:
linear 0.75 rotate -30
linear 0.75 rotate 30
repeat