Game Development Reference
In-Depth Information
If the condition in the brackets equates to TRUE , the script commands
immediately after the If statement will run. If FALSE , the script commands
immediately after the Else statement will run. The Else statement is
optional.
Multiple If statements can be nested to create an ElseIf condition.
The condition must be in brackets.
Example
This scripts tests the Action and X position of a Toon called player with
respect to a Toon called ball , and either kicks or throws the Toon ball
accordingly.
On NewFrame
Set playerAction = Get Property (player, action)
Set xdistance = Get Property (player, x) - Get Property (ball, x)
If ((playerAction = kick) and (xdistance < 1))
Set Property (ball, action) = kick
Else
If ((playerAction = throw) and (xdistance < 1.5))
Set Property (ball, action) = throw
EndIf
EndIf
End NewFrame
Detecting key presses
TScripts supports detection of key presses and left and right mouse
button clicks, using the Key command:
Key ( keycode ) <key>
' script commands to run upon keypress
EndKey
The keypress argument is the keycode of the key, or mouse button, being
detected. The <key> is the actual key or mouse button pressed and must
be entered in the script by using the Keycode Button as follows:
1 Position the cursor in the script position where you want the Key
command.
2 Press the Keycode Button.
3 Hit the key or mouse button you wish to detect.
Search Nedrilad ::




Custom Search