Image Format

Localization
Expressions
Functions
General Variables
Screen Sizes
Scene Description
Character Description
Character Properties
Commands of Character States GamePilot Lessons
Hotkeys
Technical Support

© 2017 Two Pilots

Credits

Image Format

Images are prepared in .png format. The iOS- file system is case-sensitive. File extension .png must be typed in lower cases.

In a debugging phase, you can use high resolution images prepared for iPad Retina, on both devices: iPad Retina and iPad. In this case, you need to set the size of the images to 50%; as a result, they will have the same size on different devices.

For any iPad device, sprite coordinates in Landscape mode must be in the range [0..1023, 0..767]. iPad Retina has 2048x1536 pixel screen resolution. When displayed on a screen coordinate values are automatically recalculated, so you do not need to change the program.

For iPhone devices, if in Landscape mode, sprite coordinates must be in the range [0..479, 0..319] for iPhone4 and [0..567, 0..319] for iPhone5 and above. Retina screen has the following screen resolutions: 960x640 for iPhone4 and 1136x640 for iPhone5.

Because iPhone and iPad screens have different proportions, you can use suffixes "-ipad" and "-iphone" in the names of background images. For example: StartScreen-ipad.png; StartScreen-iphone.png.

For active sprites, it is recommended to choose size so it is easy to tap and drag. If you need the same sprite size on both iPhone and iPad, do not use suffixes in the image file name.

If you need to use images of different sizes depending on the device, use the appropriate suffix before the file extension:

 Suffix   Use of the image   Example of the file name 
-iphoneiPhoneStartScreen-iphone.png
-1xiPhone Retinaanswer-1x.png
-2xiPhone5 Retinaanswer-2x.png
-ipadiPadStartScreen-ipad.png
-4xiPad Retinaanswer-4x.png

For example, the project is running on iPhone5 and the corresponded file in the table has the "-2x" suffix. If that file does not exist in the project, then the project will use the file with suffix "-1x", if that file does not exist in the project, the project will use the file with suffix "-iphone", if that file does not exist, the project will use the file without suffix.

Sprite coordinates by default are given relative to their center. Therefore it is recommended for iPad images that their size (both, width and height value) is even. Sizes of the images for iPad Retina must be twice as big and must be a multiple of 4.

Localization

A project can be translated into different languages. For example, if the project contains English and Russian localization, file Localize.str contains the following text:

0|en                     |ru                |
1|Two Pilots             |
2|Send Feedback          |Отправить отзыв   |
3|Privacy Policy         |Конфиденциальность|
4|Credits                |Благодарности     |    
5|Highscore: `Highscore  |Рекорд: `Highsore |
6|`Minutes%02:`Seconds%02|
7|`Variable%.3           |

Each string of the file begins with the phrase number, and texts of the phrases are separated by "|". To output text of the phrases, use the Text command (described further in "Commands of character states" section).

The first line starts with the number 0, and then suffixes of languages are specified. In names of .png files suffix "_ru" can be used, for example: main_shadow_ru-ipad.png.

The general variable "Language" contains the language number of the current localization.

Displayed text can include a variable value. To substitute a variable with a value, use the symbol "`" before the variable name. You can set a number format after the name of a value. The following formats are possible:
%0N – Integer numbers, contain N decimal digits and "filled in" with zers at the beginning;
%.N – Numbers in decimal format; N is a number of decimals.

Expressions

When declaring variables, their initial value can be calculated as well. For example:
В = 3*(A+20) // Declare variable B and assign the value o the expression.

You can use the following operations in the expressions:

Operation

Description

Сomment

+ Addition

Arithmetic operations

- Subtraction
/ Division
*Multiplication
Div Integer division

Integer operations

Mod Remainder of division
< Less than

The result of a logical expression can be assigned to a variable:
0 - False;
1 - True.
The priority of the comparison commands is low, therefore it is recommended that you bracket them, for example:
A = Not(C) Or (B < 5)

> Greater than
<= Less or equal
>= Greater or equal
= Equal
<> Not equal
And Logical AND
Or Logical OR
Not() Logical Inversion

The brackets after Not() are required.

The And and Or operators perform short-circuit boolean-expression evaluation, for example:
A = (i<=Count) And (X[i]>600)
If the first argument of the And command is false, than there is no need to calculate the second argument. The answer does not depend on it and the index is out of range in the process of calculating. Similarly, when the first argument of the Or command is true, the short-circuit evaluation is performed, for example:
A = (i>Count) Or (X[i]<600)

Functions

You can use the following functions in the expressions:

Function

Description

Abs(X) Number module.
Sign(X) Number sign.
Cos(Angle) Cosine of an angle. The value is specified in degrees.
Sin(Angle) Sine of an angle.
Tan(Angle) Tangent of an angle.
ArcCos(X) Arccosine.
ArcSin(X) Arcsine.
Round(X) Rounding a number.
Trunc(X) Drop the fractional part of the number.
Sqrt(X) Square root.
Random(N) Returns integer random number in the range [0..N-1].
Distance(X, Y) Calculates distance using coordinates.
Min(A, В, ...)Finds a smallest number among several numbers.
Max(A, В, ...)Finds a largest number among several numbers.
MediaTime(T)Defines time intervals, in milliseconds:
MediaTimeStart = MediaTime(0) // Definition of start time;
PastTime = MediaTime(MediaTimeStart) // Defines the time passed from the start time to now (in milliseconds).
Average(A, B, ...) Calculates the average of several numbers.
RGB(R, G, B) Returns color for the given R, G, B values, which must be in the range [0..255].
Brightness(Color) Calculates brightness of the color in% [0..100].
AverageColor(Color1, Color2, V1, V2) Calculates average color using the weight values.
AngleRange(X) Converts the angle to the range [-180..180].
AngleXY(dX, dY) Calculates rotation angle using coordinates values. For example, you can calculate the rotation angle of a character that moves in a certain direction:
Angle=AngleXY(X- AX, Y- AY)
where X, Y - current coordinates of a character;
AX, AY - coordinates of the spot the character is moving to.
Angle3(a, b, c) Calculates the angle of a triangle from the length of the sides, where:
a, b - adjacent sides of an angle;
c - opposite side of an angle.
ContainsPoint(pX, pY, MaskN, mX, mY) Determines if the point belongs to the area of the bitmap mask;
pX, pY - coordinates of the given point;
MaskN - number of the bitmap mask in the scene;
mX, mY - position of the bitmap mask in the scene (this parameter is optional).
Collision(Mask1, Mask2, mX1, mY1, mX2, mY2) Determines if the bitmap masks cross each other;
Mask1, Mask2 - numbers of the bitmap masks in the scene;
mX1, mY1 - position of the bitmap mask 1 in the scene (this parameter is optional);
mX2, mY2 - position of the bitmap mask 2 in the scene (this parameter is optional).
If there is a collision, the value of the collision angle will be assigned to the AngleCollision variable.

General Variables

There are several general variables in GamePilot. They have important parameters which are declared automatically.

Variable

Description

Value

CountScenes Amount of scenes in the stack 0 – the stack has no scenes
CurrentOrientation Current screen orientation 1 - Portrait; 2 - Landscape
Language Current language localization 0 - en. Language numbers are declared in the first string of the Localize.str file
MusicVolume Background music volume, in % [0..100]
MusicPause Pause mode of the background music MusicPause=1 - stop the background music;
MusicPause=0 - continue playing the background music.
MusicSeek Set the playback position of the background music (sec). MusicSeek=0 - the background music will be played from the very beginning;
MusicSeek=8 - the background music will be played from the 8th second.
MusicLoop Repeate mode of the background music MusicLoop =0 - the music will be played once;
MusicLoop=1 - the music will loop.
ScreenX Screen width at the current orientation One of the following values: 320; 480; 568; 768; 1024
ScreenY Screen height at the current orientation One of the following values: 320; 480; 568; 768; 1024
ScreenCX X coordinate of the screen center One of the following values: 160; 240; 284; 384; 512
ScreenCY Y coordinate of the screen center One of the following values: 160; 240; 284; 384; 512
TiltX Tilt angle of OX-axis measured by the accelerometer, in % [0..100]
TiltY Tilt angle of OY-axis measured by the accelerometer, in % [0..100]
TiltZ Tilt angle of OZ-axis measured by the accelerometer, in % [0..100]
TouchScreenX X coordinate of screen touch [0..ScreenX-1]
TouchScreenY Y coordinate of screen touch [0..ScreenY-1]
TouchSpriteX X coordinate of sprite touch [0.. WidthOfTheSprite-1]
TouchSpriteY Y coordinate of sprite touch [0.. HightOfTheSprite-1]
TypeDevice Device type 1 - iPhone; 2 - iPad
VolumeModeMode of operation with volume buttons 0 - By default, when you press the volume buttons, the standard volume adjustment window will be displayed.
1 - When you press the volume buttons, the standard volume adjustment window won't be displayed and the volume level won't change.
2 - When you press the volume buttons, the appropriate messages will be sent: VolumeUp и VolumeDown.
3 - When you press the volume buttons, the standard volume adjustment window won't be displayed and the volume level won't change. When you press the volume buttons, the appropriate messages will be sent: VolumeUp и VolumeDown.

For example, coordinates for iPad in Landscape orientation are set relative to bottom left corner of the scene in the following range: [0..1023, 0..767].

We recommend that you use variables ScreenX, ScreenY for commands where screen size is considered. And that you use variables ScreenCX, ScreenCY to set the screen center.

Mode

ScreenX ScreenY ScreenCX ScreenCY
iPad Portrait 768 1024 384 512
iPad Landscape 1024 768 512 384
iPhone 5; 6 Portrait 320 568 160 284
iPhone 5; 6 Landscape 568 320 284 160
iPhone 4 Portrait 320 480 160 240
iPhone 4 Landscape 480 320 240 160

Scene Description

The file of scene description (.sc) is meant to describe position of images and characters on game scenes.

Scene description always begins with the Scene Start command.

Below is a list of commands that you can use to describe a scene:

Command

Description

Scene SceneName The Scene command sets a name for a scene.
Orientation(Landscape) Set Landscape orientation for a scene.
Orientation(Portrait) Set Portrait orientation for a scene.
Orientation(Landscape+Portrait) The scene can be played in both, Landscape or Portrait orientation.
Autorotate(0) Auto-rotate screen mode. 0 – Auto-rotate screen mode is disable; 1 – Auto-rotate screen mode is enabled.
Variable = 10 Lets you declare a general variable and set its value.
Store(Variable) If the variable is set in the Store.plist configuration file, its value will be taken from the file. As the scene runs, the value is tracked. When the scene is over, the value is stored in the Store.plist file.
Music(FieName) Play the background music FileName.mp3 in loop, as the scene runs.
Png(FileName, X, Y, L, H) Output a .png-picture at X,Y coordinates; you should set the size for the picture (L, H).
Person(PersonName, State, X, Y) Place a character on the scene; after the character initialized, the commands of PersonName.stt file will be executed, beginning with the specified state. By default, the coordinates of the character are set for its center.
Value(Variable, X, Y, Color, H, Font) Display a value of a variable.
PixelMask(FileName, X, Y, Tolerance) Set a pixel mask; the size is determined from the image file. Tolerance [0..255] – is opacity tolerance for pixel color, by default the value is 50.
Parallax(sky_bottom, 90, 50) You can display background images with Parallax effect, 90 and 40 – are the Parallax coefficients; 50 - is the scale the background image.
Parallax(sky_top, 40, 50)

If GamePilot starts and there is a file Start.sc in the Documents folder, the program will work in the „one game“. Otherwise, the program will open a dialog to choose the mode:

If you choose to work locally, GamePilot makes a list of projects in the Document folder. Each project has its own name, and the name of the scene file of the project is equal to the project name, for example:

If you choose to work using FTP, GamePilot loads the project list from FTP. If the project name contains "IPhon", this project is meant for iPhone. You can open this project on iPad, and it will run in a "iPhone Window" mode.

Character Description

The character state description text is stored in a file with the extension stt, for example: Character,stt.

Each line of the file characterizes the character's state which is specified by the properties. In the text there can be lines with comments which begin with the characters "//". At the beginning of the character description file, there is a head, which can contain several lines with commands. The head ends with a line that contains a status number and a ":" symbol, for example:

// State description of the character Character,stt
// Head commands at the beginning of the file 
Scale = 50  // Setting scale (%)

1:   // Here will be description commands for state 1.

Rest // The commands execution of the 1 state ends. 
2:   // Here will be description commands for state 2.

Rest // The commands execution of the 2 state ends.

The state file is executed from top to bottom, line by line. When creating a character, the head commands execute without delay. After that, the character goes into the mode of execution of the specified state. The time for changing each line is specified by the Delay command. The default value is Delay=100 ms. A different Delay value can be specified in the header, then the lines of the main stream will be executed with this delay. Empty lines are skipped, they do not affect the process.

Coordinates of characters are set relative to bottom left corner of the screen. For a child sprite, coordinates are set relative to bottom left corner of a parent sprite.

Coordinates of a sprite are defined for the point O, which is the rotation point of the sprite. The default rotation point is in the middle of an image. The rotation point is set using oX, oY commands and is expressed in percentage of image width/height.

Images for animation of a character should have names like: Person001.png, Person002.png, Person003.png, and so on. An image name can contain a suffix.

These images should then be packed with TexturePacker, and the resulted files should have names like:
Person-ipad.png – these are the whole sprite images;
Person-ipad.plist – this is a description of how the images are packed.

For Retina iPadhd, you will need the following version:
Person-4x.png;
Person-4x.plist.

Person.stt – description of the character.

To simplify the debugging process, at the beginning you can work with the files without packing them, i.e. direct with the files Person000.png, Person001.png, and so on. After you worked out the character and its behavior, its images should be packed with TexturePacker into a file Person.png. The Person.plist file should describe how the images are packed. If there is a Person.plist file, GamePilot works with packed images. If there is not a file Person.plist, Game Pilot works with standalone files.

Each string of a state file (.stt-file) describes a character state, which is determined by particular properties. The state file runs top-down, string by string. The time each string runs is defined by the Delay command. Empty strings are ignored and don't impact the process.

Character Properties

Property

Example

Description

Aif Aif=1 Sound playback from the Person001.aif file.
Aif The command without parameter turns off playback of the previous sound.
if Aif>0 The Aif property returns the number of a playing sound. When there is no playing sound for the character at the moment, the value -1 returns.
Angle Angle = 90 Sets the angle (rotation) of the sprite and is measured clockwise in degrees. Negative angle goes counterclockwise.
Count Destroy[Count] Amount of child sprites or subordinate characters.
Color Color = ColorGreen Defines color of a character. Color constants: ColorBlack, ColorDarkGray, ColorGray, ColorLightGray, ColorWhite, ColorRed, ColorGreen, ColorBlue, ColorCyan, ColorYellow, ColorMagenta, ColorOrange, ColorPurple, ColorBrown. You can define color in hexadecimal system (for example: 0x00FFA0), or calculate using the RGB-function (R, G, B).
FontSize FontSize=40 Font Size for the Value command.
Thickness Thickness=5 Line Thickness for the Line command.
FlipX FlipX=1 Sprite output, horizontal mode: 0 – normal, 1 - mirr horizontally.
FlipY FlipY=1 Sprite output, vertical mode: 0 – normal, 1 - mirr vertically.
MoveX X=MoveX These properties allow you to find out coordinates of a sprite while the sprite is moving.
MoveY Y=MoveY
Mp3 Mp3=1 Sound playback from the Person001.mp3 file.
Mp3 The command without parameter turns off playback of the previous sound.
if Mp3>0 The Mp3 property returns the number of a playing sound. When there is no playing sound for the character at the moment, the value -1 returns.
OX OX = 60 Sets coordinates of a sprite (60,40). This is the rotation point of the sprite (to set rotation, use the Angle command). The coordinates are expressed in percentage of image width/height. The default rotation point is in the middle of an image (50,50).
OY OY = 40
Opacity Opacity=50 Sprite opacity, expressed in %: 0 – fully transparent, 100 – the usual conclusion of the sprite.
ParentIndex Sprite index in the parent array.
Pause Pause=1The execution of the character state streams pauses.
Pause=0 The character state streams continue to execute.
Pause[2]=1 You can set any subordinate sprite or character to pause mode; for this purpose indicate its number.
Priority Priority=0 Priority of the touch processing:
0 - The sprite is ignored;
1 - Default value;
2 - High priority, which allows you to process sprite touching (touching should be as much close as possible to the sprite center), even if there are other sprites over this one.
ScaleX ScaleX=50 Resize picture horizontally, expressed in %.
ScaleY ScaleY=120 Resize picture vertically, expressed in %.
Scale Scale=30 Resize picture, expressed in %.
StoreStore[i]=ValueRecords the number to a character array:
Value − is the value that is being recorded;
i − is the number of the array element, the count begins from 0. If te amount of array elements is less or equal to i, this amount increases automatically. After the array changed, it records to the file Store.plist with the name of the character.
Store=3The Store property is used to determine and change the number of elements in an array.
TouchIndex Index=TouchIndex If a composite character gets a touch message, the TouchIndex value indicates which child sprite was touched.
Img Img=3 Set the picture with an appropriate number; sets the Person003.png picture.
Volume Volume = 50 mp3-file playback volume, expressed in %.
X X=150 Sprite coordinates, set relative to bottom left corner of the parent sprite.
Y Y=100
Z Z=50 Move upwards. If there are several sprites on each other, the sprite with the largest Z value will be above other sprites.

The Delay parameter defines the time required to execute commands in each string, expressed in ms. For example, there are three commands in the following string:
Delay=200 dX=5 Scale=90
The Delay command will not wait and will be executed immediately. The dX=5 command will start the process "smooth movement 5 points to the right, within 200 ms". At the same time, the Scale=90 command will start the process "resize the image to 90% of its original size within 200 ms". When the string is over, there will be a delay of 200 ms. This time will be used for the commands dX=5 Scale=90 to execute.
If Delay=0, there won't be any delay at the end of the string, and the next string will be executed.

Commands of Character States

Command

Example

Description

Delay Delay=1000 Defines the time required to execute commands in the string, expressed in ms.
State State=2 Change to the certain state. The states are numbered with "1:"; "2:" in ascending order.
dA dA=20 Smooth rotation of a character clockwise, measured in degrees. Use a negative value for rotation counterclockwise.
dX dX=10 Sets the distance for smooth moving of a character to the right. Use a negative value for moving to the left.
dY dY=20 Sets the distance for smooth moving of a character to the top. Use a negative value for moving to the bottom.
Fade Fade Output and fade the sprite.
Show Show A sprite disappears and re-appears.
Blink Blink=3 A sprite appears and disappears 3 times.
dSX dSX=10 Smooth increase image width at 10% (you will get 110% of the original size). A negative value will let you decrease image width.
dSY dSY=-10 Smooth increase image height at 10% (you will get 110% of the original size). A negative value will let you decrease image height.
dS dS=5 Smooth increase image size at 5% (you will get 105% of the original size). A negative value will let you decrease image size.
Hush Hush=300 Smooth sound fading, within the next 300 ms.
Hush The command without parameter: smooth sound fading, within the time defined by Delay.
New New=3 Run a new parallel state 3.
NotificationNotification[N]=T Assigns a local notification, which will be displayed after T seconds. At a defined time, if the application is not active, text from the file Localize.str will be displayed and sound Name00N.mp3 will be played, all according to the notification number (N). The assigned sound will be outputted only when the project is built in xCode; when you start the project in GamePilot, the sound of the standard notification will be outputted. You can set several local notifications. Local notification is outputted only if the application is not active; if the application is active, nothing happens.
NotificationCommand Notification without parameters resets all local notifications.
Stop Stop=3 Stops execution of the 3 state (from another stream).
Stop The Stop command without parameter stops execution of all state streams.
Scene Scene=NameScene Change to the NameScene scene.
StackScenes StackScenes=NameScene The current scene will stop and will be put to the scene stack, then the NameScene scene will run. The amount of scenes in the stack are defined with the CountScenes general variable.
StackScenes The command without parameter will stop execution of the current scene, the deferred scene will retrieve from the stake and continue.
Rest Rest This command ends the process of commands execution.
Destroy Destroy Ends operation of a character.
Value Value[1]=5 The defined value will be a sprite image. The font size can be determined with the FontSize variable.
Vibe Vibe Output of the standard vibration on iPhone (380 ms). On iPad, the vibration is substituted by a similar sound.
Text Text[1]=2 The phrase from the Localize.str file will be a sprite image, in accordance to the Language value.
Line Line[1]=80 The 80 point long line will be a sprite image. You can define its thickness with the Thickness property.
Send Send=TestMsg Send the "TestMsg" message.
Slot[] Slot[TestMsg]=3 If the "TestMsg" message received, the character goes to state 3.
Timer[0] Timer[0]=700 Sets time for the timer (0 to 700 ms). The character can use up to 5 timers.
Slot[Time0_] Slot[Time0_Name]=4 Registers timer slot, where Name is the name of a character.
The state 4 will be called periodically.
Slot[Time0_Name] The command without parameter disables processing of the timer message.
Slot[Touch_] Slot[Touch_Self]=1 When touched, the character goes to state 1.
Slot[Move_] Slot[Move_Self]=5 When dragged, the character goes to state 5.
Move Move Moves the character to the position of the dragging finger.
Slot[LetGo_] Slot[LetGo_Self]=2 When released, the character goes to state 2.
Slot[VolumeUp] Slot[VolumeUp]=6 When you press the "increase volume" button, the character goes to State 6. The VolumeUp and VolumeDown events will be sent if the VolumeMode variable has the value 1 or 3.
Slot[VolumeDown] Slot[VolumeDown]=7When you press the "decrease volume" button, the character goes to State 7.

Game Pilot tries to process messages promptly. Therefore, it will use the Delay=0 value to change to the appropriate state for processing message. If you define delay time for message processing, then the processing commands and the commands from the main stream will be executed simultaneously.

For one character, there could be several running state streams at the same time. The New=N command starts the N state in the new stream, for example: New=13. To stop this state from another stream, you can use the Stop=13 command. The Stop command without parameter stops execution of all state streams.

When a character starts, commands of the main stream automatically run. To stop the main stream from another stream, use the Stop=0 command.

Furthermore, a parallel state will be created for message processing. For example, to process the following touch message:
Slot[Touch_Self]=5,
the state 5 will be created. To stop execution of this state from another stream, use the Stop=5 command.

The example below shows you processing of touch messages for the Name character:
Img=1
Slot[Touch_Name] = 1 // Register character touch slot
Slot[Move_Name] = 5 // Register character move slot
Slot[LetGo_Name] = 2 // Register character release slot
Slot[Time0_Name] = 4 // Register timer slot
Timer[0]=1000 // he time is expressed in ms. In this case, the timer will send the Time0_Name signal every second.
Rest
1: mp3=1 // Play sound when touched
Rest
2: Img=2 Slot[LetGo_Name]=3 // Re-register slot
Rest
3: Img=1 Slot[LetGo_Name]=2
Rest
4: Delay=300 Show // Smooth re-appear
Rest
5: AX=MoveX AY=MoveY // Determine coordinates of the new position of the character
if ContainsPoint(AX, AY, 1) Rest // Check if movement possible
X=AX Y=AY // If without overlays, move the character into the defined position
Rest

You can let run several identical characters with the name Name simultaneously. Touching of one character produces the Touch_Name event, which will be processed with all registered slots. If you need that the character processes only its own touch events, you need process the messages Touch_Self, Move_Self, LetGo_Self.

A character has an array, which contains subordinate sprites or subordinate characters. When a subordinate sprite or a subordinate character is created, it gets a number (index in the array). Using this index, a main character can change properties of subordinate sprites or characters. A child sprite is a sprite, thats coordinates depends from the character. To operate a sprite, you should define its number. The main parent sprite of a character has number 0. If a parent sprite scales or rotates, the same happens to all its child sprites.

Using special commands in the head of the state file, you should define parent name for each sprite except sprite 0. For example:
Parent[1]=0 // Declare sprite 1, thats parent is sprite 0
Img[1]=1 // Image of sprite 1 – Person001.png
Parent[2]=1 // Declare sprite 2, thats parent is sprite 1
Img[2]=2 // Image of sprite 2 – Person002.png
cX[1] = 200 cY[1] = 100 // Set the coordinates for sprite 1 relative to the parent sprite center

1: Delay=500 // Below is the description of 1 state
dA[0]=10 // Rotate the parent sprite at 10°; the child sprites wil rotate as well
dS[2]=50 // Increase the size of sprite 2 at 50%

Thus, a parent sprite can have several child sprites. The order, in which sprites are overlayed, is defined by the Z property. A child sprite with a greatest Z value will be in foreground and will overlay other sprites. To put a child sprite behind its parent, use a negative Z value.

If a composite character gets a touch message, the TouchIndex value will indicate which child sprite was touched. A composite character can have several sprites that overlay each other. But also in this case, only one touch message will be sent. This message will contain the number of the sprite that has the largest value in the parent array.

A character can create subordinate characters with the command: Person[1]=NamePers.
This command will load the subordinate character and will execute commands in the head of its state file. To put the subordinate character into operation mode, you should set its state with the command State[1]=N. When you work with properties of subordinate characters, you should specify an index for each one. For example, you can set coordinates of a subordinate character as follows: X[1]=CoordinateX Y[1]=CoordinateY.
After the subordinate character ended its operations, you can remove it with the command Destroy[1].

A character has the Count property, which allows you to define amount of child sprites and subordinate characters. For example, we have two child characters: Person[1]=Name1 Person[2]=Name2. The Count property will have value 2. If you destroy the first character with the Destroy[1] command, the Count value will be 1 less, and the second character will become the first one.

In state (.stt) files, you can also use local variables, calculate Expressions, check conditions and execute groups of commands. Before you use a local variable, you should declare it, for example:
VariableName = 23 // Declare local variable and assign value

You can apply to a variable using an index value:
VariableName[2] = 23
If you need a general variable for all characters, you must declare it in the scenario (.sc) file.

You can use Expressions in state descriptions. For example:
X=A+20 // Add 20 to the value of the A variable and set is as X coordinate of the character.
if TouchIndex=1 Rest // If the value of the TouchIndex variable is 1, go to Rest

The "if" command has the following syntax: if Expression Command else Command.
The "else Command" block is optional.

For "Command", you can also use several commands as well. In this case, you should group them using the "{ }" brackets. You can also use a nested "if". If you use "if" several times, for instance: "if ... if ... else", then "else" relates to the last "if".

The http command allows you to go to an appropriate page in Internet, for example:
if NomerMenu=7 { http://www.2pilots-games.com/ Rest}
if NomerMenu=8 { https://www.facebook.com/2pilots Rest}

The "To" command increases the value of a variable by 1 (between the initial value of the range and final value, inclusive) and executes the appropriate command several times.
Variable = ExpressionFrom То ExpressionTo Comman
Before executing the "To" loop, the value ExpressionFrom is assigned to the variable.

If this value is greater than ExpressionTo, the loop will not execute. Otherwise, the command (or, several commands grouped in the "{ }" brackets) will execute, the variable will increment by 1 and the loop condition will be checked again. Then, the variable is equal ExpressionFrom+1.

Here is an example of how to create four child characters:
i=1 To 4 { Person[i]=Name State[i]=2 X[i] = i*100 + 50 }

The loop command "Downto" decrements the value of a variable by 1 (between the initial value of the range and final value, inclusive) and executes the appropriate command several times.
Variable = ExpressionFrom Downto ExpressionTo Command.
Here is an example of removing of all child characters:
i=Count Downto 1 Destroy[i]

Hotkeys

Hotkey

Command

Description

Cmd+S Save Save text in the editor, send via FTP and update files from FTP.
Cmd+R Run Save text in the editor, send via FTP, update files from FTP and run the scene again. If the .sc-file is open in the editor, the Start scene will start. If a .stt-file is open in the editor, the current scene will start.
Cmd+P Person Open the text of a character which is marked by the cursor. You should set the text cursor on the name of the character and press Cmd+P to open its text.
Cmd+E Edit Show/hide the editor.
Cmd+T X,Y Insert coordinates of the last screen touch into the text. These coordinates are shown on a special button on the editor toolbar. You can insert them into the text also by clicking this button.
Cmd+Down   Move the editor window down to the bottom of the screen.
Cmd+Up   Move the editor window up to the top of the screen.
Cmd+=   Expand the editor window to fill the entire screen.
Cmd+? Help Open the Help window.
Cmd+W Wait Stop the scene. Use this command to set the position for a character on the screen. If you touch a character or an image in this mode, the editor will open and the cursor will mark the appropriate command. Now, you can pick up and drag the character on the screen. You can also drag it using the Alt+arrows buttons on the keyboard. If the editor is closed, you can move the character by 10 points using the arrows.
Cmd+L   Set / remove a breakpoint. You can set breakpoints to debug texts of character description files (stt). If you set a breakpoint for a line in the editor, its number is highlighted with a rectangle.
Cmd+N Next Execution of character description text until the next line. If you selected Wait from the editor menu (or, used Cmd+W) to stop the scene, the current executable lines of the character description are highlighted with green rectangles. If you press Cmd+N, the program will execute until the next executable line. Then, the scene will stop and the next executable line will be highlighted.
Cmd+Z Undo Undo changes made in the editor. If you changed the coordinates of a picture by dragging it on the screen, the command lets you undo the changes in the text and moves the picture or the character back.
Cmd+Shift+Z Redo Redo changes made in the editor.
Cmd+F Find Search text after the current cursor position.
Cmd+G Next Find the next occurrence of the text in the editor.
Cmd+Shift+G Previous Find the previous occurrence of the text in the editor.
Cmd+O Opacity Enable/disable opacity/transparency mode of the editor window.
Cmd+<   Decrease transparency of the editor window.
Cmd+>   Increase transparency of the editor window.

Setting of breakpoints, step by step execution (execution "until the next line") and working with FTP are unavailable in Game Pilot Lite version.

Technical Support

If you have any problems questions related Game Pilot, please contact us.
 

Credits

Game Pilot uses the following libraries and tools:

cocos2d: Cocos2D-SpriteBuilder: http://cocos2d.spritebuilder.com , http://cocos2d-objc.org
Copyright © 2008-2011 - Ricardo Quesada and contributor
Copyright © 2011-2012 - Zynga Inc. and contributors

CocosDenshion Sound Engine:
Copyright © 2010 Steve Oldmeadow

Kazmath:
Copyright © 2008, Luke Benstead