|
|
|
|
Open Game Maker 2D
Tutorial - Lesson 2
|
|
|
|
|
|
Lesson 2 is a very
important lesson for guys to understand OGM2D.
|
|
|
It will show you how to use sprite components and the
sprite component concept is the core of OGE/OGM. |
|
|
|
|
| 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 STG sample |
|
|
Please first download the
sample resource from the following link: |
|
|
gameres/stgsample.res.zip
|
|
|
Click the "import" button
(on the toolbar of the resource list) to start to import the game
resource. |
|
|
|
|
|
Select "stgsample.res.zip"
to import.
|
|
|
|
|
|
Wait
till it's done.
|
|
|
|
|
| | |
| Step 3 - Add map to the scene | |
| Active the game map resource list. | |
| | |
| Drag and drop the "FightMap" map onto "MyScene". | |
| | |
| | |
| | |
| Step 4 - Add sprites to the scene | |
|
Active the sprite resource list.
|
|
|
|
|
|
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 "Enemy" sprite onto "MyScene", and name it as "Enemy1" |
|
|
|
|
|
|
|
|
|
|
|
Step 5 - Try to run the STG sample scene |
|
|
Click "Run scene" button on the toolbar. |
|
|
|
|
|
Then you would see the scene will be executed. |
|
|
|
|
|
You can use keyboard to control the player. The arrow keys control the movement and the Left Control Key is for shooting. |
|
|
|
|
|
Step 6 - Add more enemy sprites to the scene |
|
|
Please first close the running scene, we should continue with our lesson :) |
|
|
Refer to Step 4, let's add 7 more enemy sprites onto the scene. |
|
|
And their names should be "Enemy2", "Enemy3", "Enemy4", "Enemy5","Enemy6", "Enemy7", "Enemy8". |
|
|
|
|
|
|
|
|
Step 7 - Make some changes to the enemy sprites |
|
|
In this lesson, let's just focus on the following custom properties first: BulletStyle, EnterTime and MovePath . |
|
|
|
|
|
Here are these three properties' meanings: |
|
|
BulletStyle - How to fire ("-1" means no fire, so you may try with 0 or 1 if you want the enemy to fire) |
|
|
EnterTime - When to appear ("2" means "when the scene's elapsed time is 2 seconds" ) |
|
|
MovePath - How to move (you can find the path objects in path resource list) |
|
| Let's make some changes to the enemy sprites according to the table below: | |
| Sprite Name | BulletStyle | EnterTime | MovePath | Enemy1 | 0 | 2 | ZPathA | Enemy2 | 0 | 2.5 | ZPathA | Enemy3 | 0 | 3 | ZPathA | Enemy4 | 0 | 3.5 | ZPathA | Enemy5 | 0 | 2 | ZPathB | Enemy6 | 0 | 2.5 | ZPathB | Enemy7 | 0 | 3 | ZPathB | Enemy8 | 0 | 3.5 | ZPathB |
| |
| And then let's run the scene again to see what will happen :) | |
| | |
| | |
| Step 8 - Try to change the image and sound bound to the sprites | |
| If you don't like the player's shooting sound, you may change it. (you can find the sounds in media resource list) | |
| | |
| If you want to change some enemy's image, you can do it by setting a new image name to "AltImage" property. | |
| | |
| But please note that the alternate image must have the same format with the sprite's animation's image. | |
| Okay, now let's see the final result screen of today's lesson: | |
| | |
| Press the "Run scene" button and have fun :) | |
| | |