Home Lessons Apps Support About Consultations We create games Contact
Home Lessons Apps Support About Consultations We create games Facebook

Lesson 4: Character properties & commands of character states.

Select the device which you develop the application for:
 

We will learn:
- The Angle character property.
- The Delay command.
- The commands that make a character move or rotate: dX, dY, dA.
- How to make a character execute several sequential actions.
 

You can output a character on the screen so that it is rotated at a certain angle, you can mirror it, make it transparent or change its size. In other words, you can assign a character many different properties. Character properties are specified in the .stt-file of a character.

Today we will speak about the Angle property. This property sets the angle (rotation) of a character.

Let us say, we have the following code for our character:

 

- - - - - CODE BEGIN - - - - -

Scale = 50

1: Img=1
   Rest

- - - - - CODE END - - - - -

 

Now, we will output the character rotated at 45 degrees (clockwise). We will edit the code like this:

 

- - - - - CODE BEGIN - - - - -

Scale = 50

1: Img=1 Angle=45
   Rest

- - - - - CODE END - - - - -

 

If the Angle value is negative, for example, Angle=-45, the character will be rotated counterclockwise.

 

Task 1:

There are two characters in the project that you created yourself on the previous lessons.

Edit the .stt-files of these characters so that one of them is rotated at 30 degrees clockwise, and the other – at 50 degrees counterclockwise.

You can edit the code directly in Game Pilot or, on your computer. If you edited your project on the computer, transfer the changed files to your iPad.
 

Besides the Angle property, there are many other properties in Game Pilot. You can find a table that describes all the properties, in Help (as you know, you can open Help from the menu in Game Pilot editor). There are some properties that correspond to text only (one can output text on the screen as well as graphics).

Characters on the screen can be brought into different states. For example, a character can move, spin, decrease or increase, disappear, become transparent, and so on. There are special commands for this.

Commands of character states, as well as character properties, are specified in the .stt-file of a character.

Let us say, our character is static on the scene:

 

- - - - - CODE BEGIN - - - - -

Scale = 50

1: Img=1
   Rest

- - - - - CODE END - - - - -

 

Now, we make it move. For this purpose, add the following command to the code:

Delay=200 dX=100

This command means: within 200 ms, increase the value of X coordinate at 100. The character will move to the right. If we add the command to the code, we will get:

 

- - - - - CODE BEGIN - - - - -

Scale = 50

1: Img=1
   Delay=200 dX=100
   Rest

- - - - - CODE END - - - - -

 

The dX command changes the X coordinate of a character. If it is a positive number, the value of X increases and the character moves to the right.

If it is a negative number, for example: dX=-70, the value of X decreases and the character moves to the left.

There is also a command dY. This command changes the Y coordinate. If it is a positive number, the value of Y increases (the character moves upwards) and if it is a negative number, the value of Y decreases (the character moves down).

If the character is in the bottom left corner and we want to move it into the top right corner, we need to increase the X and the Y coordinate simultaneously. The following line is an example of such a movement:

Delay=200 dX=850 dY=600

Delay is a character parameter that defines how long (in milliseconds) one should wait the execution of the commands in the line.

The command Delay=200 will not wait and will be executed immediately. The command dX=850 will start the process "smooth movement to the right – 850 points within 200 ms“ and also will not wait and will be executed immediately. At the same time, the command dY = 600 will start the process "smooth movement upwards - 600 points within 200 ms". When the line is finished, there will be a delay of 200 ms, during which the commands dX = 850 dY = 600 will be executed.

If Delay=0, there won't be any delay at the end of the string, and the next string will be executed.

 

Task 2:

In your project, change the .stt-files of the characters so that one of the characters moves to the right and the other one moves upwards. Set the distance and the delay time for the movement. Look how the characters move if you set different delay time for each character.

 

Task 3:

In your project, change the .stt-files of the characters so that the X and the Y coordinates of each character change simultaneously. Characters will move obliquely.
 

You can read about all commands of character states in Help.

A character can perform several sequential actions. It can, for example, move and then stop and turn:

- - - - - CODE BEGIN - - - - -

Scale = 50

1: Img=1
   Delay=1000 dX=200 // move 200 points to the left within 1000 milliseconds
   Delay=500 // wait 500 milliseconds
   Delay=200 dA=180 // turn 180 degrees within 200 milliseconds
   Rest

- - - - - CODE END - - - - -

 

The dA command means smooth rotation of a character clockwise, at a certain angle (measured in degrees). If the value of the dA command is negative, the rotation will be counterclockwise.

 

Task 4:

Change your project so each character performs several sequential actions. You can use commands dA, dX, dY or any other command that you can find in Help (see Commands of Character States).
 


Privacy Policy    Terms of Use     Copyright © Rais Garifullin