|
|
|
|
Open Game Maker 2D
Tutorial - Lesson 3
|
|
|
|
|
|
Lesson 3 actually is an extension of lesson 2.
|
|
|
It will continue to show you how to create a game quickly with sprite components. |
|
| But this time we are going to make a RPG game. | |
|
|
|
| Step 1 - Create a new empty game | |
| Please follow
Step 1 in Lesson 1 to create a new empty game. | |
| | |
|
Step 2 - Import game
resource of RPG sample |
|
|
Please first download the
sample resource from the following link: |
|
|
gameres/rpgsample.res.zip
|
|
|
Click the "import" button
(on the toolbar of the resource list) to start to import the game
resource. |
|
|
![](img/imp_res_1.jpg)
|
|
|
Select "rpgsample.res.zip"
to import.
|
|
|
![](img/rpg_imp_res.jpg)
|
|
|
Wait
till it's done.
|
|
|
![](img/rpg_imp_res_2.jpg)
|
|
| | |
| Step 3 - Set the font of the game | |
| Double click the game's name in the scene list to open the game's property dialog. | |
| ![](img/rpg_game_1.jpg) | |
| Fill the "Font Name" field and "Font Size" field in the pop-up dialog, and press "OK" button to close it. | |
| ![](img/rpg_game_2.jpg) | |
| | |
| Step 4 - Add map to the scene | |
| Active the game map resource list. | |
| ![](img/rpg_map_1.jpg) | |
| Drag and drop the "RpgMap" map onto "MyScene". | |
| ![](img/rpg_map_2.jpg)
| |
| ![](img/rpg_map_3.jpg)
| |
| | |
| Step 5 - Add sprites to the scene | |
|
Active the sprite resource list.
|
|
|
![](img/rpg_spr_1.jpg) ![](img/rpg_spr_2.jpg)
|
|
|
Drag and drop the "SceneResetter" sprite onto "MyScene", and name it as "SceneResetter1". |
|
|
![](img/rpg_spr_3.jpg)
|
|
|
Continue to drag and drop the "SceneAction" sprite onto "MyScene", and name it as "SceneAction1". |
|
|
![](img/rpg_spr_4.jpg)
|
|
|
Continue to drag and drop the "Player" sprite onto "MyScene", and name it as "Player1" |
|
|
![](img/rpg_spr_5.jpg)
|
|
|
Continue to drag and drop the "TilePlot" sprite onto "MyScene", and name it as "TilePlot1" |
|
| ![](img/rpg_spr_6.jpg) | |
| ![](img/rpg_spr_7.jpg) | |
|
Finally press "Save file" button to save the scene. |
|
| ![](img/rpg_scene_1.jpg) | |
| | |
| Step 6 - Add plot content with Script Builder | |
| Let's select "TilePlot1" sprite in the scene, and then press the "Script Builder" button on the toolbar. | |
| ![](img/rpg_spr_8.jpg) | |
| Then the "Script Builder" dialog will be shown. | |
| ![](img/rpg_spr_9.jpg) | |
| Click "Append" button to open the "Script Code" dialog, and input something as the following screen and press the "OK" button. | |
| ![](img/rpg_spr_10.jpg) | |
| ![](img/rpg_spr_11.jpg) | |
| Continue to click "Append" button to open the "Script Code" dialog again, and input something as the following screen: | |
| ![](img/rpg_spr_12.jpg) | |
| ![](img/rpg_spr_13.jpg) | |
| Continue to click "Append" button to open the "Script Code" dialog again, and input something as the following screen: | |
| ![](img/rpg_spr_14.jpg) | |
| ![](img/rpg_spr_15.jpg) | |
| Okay, then we should finally click the "Apply" button to close the "Script Builder" dialog: | |
| ![](img/rpg_spr_16.jpg) | |
| | |
|
Step 7 - Try to run the RPG sample scene |
|
|
Click "Run scene" button on the toolbar. |
|
|
![](img/stg_scene_1.jpg) |
|
|
The scene will be executed and you can use the mouse or keyboard to control the player. |
|
|
If you use keyboard, the arrow keys will control the movement and the Space Key is the action key. |
|
|
![](img/rpg_spr_17.jpg) |
|
| | |
|
Step 8 - Add NPC sprite to the scene |
|
|
Please first close the running scene, we should continue with our lesson :) |
|
|
Refer to Step 5, let's add "Npc" sprite and "NpcPlot" sprite onto the scene, and their names should be "Npc1", "NpcPlot1". |
|
|
Refer to Step 6, select "NpcPlot1" sprite in the scene, and press the "Script Builder" button to open "Script Builder" dialog. |
|
|
![](img/rpg_spr_18.jpg)
|
|
|
Continue to refer to Step 6, we can add some plot to "NpcPlot1" with the "Script Builder" dialog and "Script Code" dialog. |
|
| But this time we should select the "Plot on NPC", not the "Plot on tile". | |
| ![](img/rpg_spr_19.jpg) | |
| ![](img/rpg_spr_20.jpg) | |
| ![](img/rpg_spr_21.jpg) | |
| ![](img/rpg_spr_22.jpg) | |
| ![](img/rpg_spr_23.jpg) | |
| And finally we should click the "Apply" button to close the "Script Builder" dialog again. | |
|
| |
| Step 9 - Bind "NpcPlot1" to "Npc1" | |
| Select "Npc1" in the scene again, and set its "PlotName" property as "NpcPlot1". | |
| ![](img/rpg_npc_2.jpg) | |
| | |
|
Step 10 - Set NPC's movement range |
|
|
We hope the "NPC1" will walk only in the area below: |
|
|
![](img/rpg_npc_3.jpg)
|
|
| So we need to update some property values of the "Npc1" like this: | |
| ![](img/rpg_npc_4.jpg) | |
| | |
| And now we can run the scene again to test the plot on "NPC1" | |
| ![](img/stg_scene_1.jpg) | |
| Press the "Run scene" button and you would get the last game screen of lesson 3: | |
| ![](img/rpg_scene_2.jpg) | |
| Enjoy it :) | |
| | |
| | |
| | |
| | |
| | |
| | |
|
| |
| | |