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.




Select "rpgsample.res.zip" to import.





Wait till it's done.


 

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.
Fill the "Font Name" field and "Font Size" field in the pop-up dialog, and press "OK" button to close it.
Step 4 - Add map to the scene
Active the game map resource list.
  
Drag and drop the "RpgMap" map onto "MyScene".


Step 5 - Add sprites to the scene

Active the sprite resource list.





Drag and drop the "SceneResetter" sprite onto "MyScene", and name it as "SceneResetter1".


Continue to drag and drop the "SceneAction" sprite onto "MyScene", and name it as "SceneAction1".




Continue to drag and drop the "Player" sprite onto "MyScene", and name it as "Player1"



Continue to drag and drop the "TilePlot" sprite onto "MyScene", and name it as "TilePlot1"
Finally press "Save file" button to save the scene.
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.
Then the "Script Builder" dialog will be shown.
Click "Append" button to open the "Script Code" dialog, and input something as the following screen and press the "OK" button.
Continue to click "Append" button to open the "Script Code" dialog again, and input something as the following screen:
Continue to click "Append" button to open the "Script Code" dialog again, and input something as the following screen:
Okay, then we should finally click the "Apply" button to close the "Script Builder" dialog:
Step 7 - Try to run the RPG sample scene
Click "Run scene" button on the toolbar.
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.
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.

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".
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".
 
Step 10 - Set NPC's movement range
We hope the "NPC1" will walk only in the area below:

So we need to update some property values of the "Npc1" like this:
And now we can run the scene again to test the plot on "NPC1"
Press the "Run scene" button and you would get the last game screen of lesson 3:
Enjoy it :)