clickball: introduction to game maker - Moodle

Adapted from Bill Kerr’s Clickball Basics 50 Steps
By Julie Clune
Saint Ignatius’ College
GAMEMAKER 7
A) Make a wall sprite and a ball sprite ...................................... 2
B) Create wall objects ............................................................ 3
C) Define a room ................................................................... 3
D) Create ball objects............................................................. 4
E) Program Events ................................................................ 4
F) Add two ball objects .......................................................... 6
G) Play the game................................................................... 6
H) Including Game Information in your program ........................ 6
I)
Add a sound ..................................................................... 8
J)
Moving to a new room....................................................... 10
K) Creating a message box .................................................... 11
L)
Programming Function Keys ............................................... 12
M) Using the Keyboard arrow keys to move an object................. 13
N) Shooting Darts and Hitting Balloons .................................... 14
O) Changing an object after it has been hit ............................... 15
P) Using view to create spaces larger than the window size
specified ......................................................................... 16
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-1-
7/14/2017
GAMEMAKER 7
`CLICKBALL: INTRODUCTION TO GAME MAKER
- build a basic game in 54 simple steps
A) Make a wall sprite and a ball sprite
1.
2.
3.
4.
5.
6.
Resources > Create Sprite > Load Sprite Button > Maze Folder > wall.gif
> Open
Name the sprite sprWall
Uncheck the Transparent checkbox for the wall sprite, since there is no
background
Resources > Create Sprite > Load Sprite Button > Maze Folder >
ball_blue.gif > Open
Name the sprite sprBlueBall.
Keep the Transparent checkbox checked for the blue ball sprite to keep
the background transparent
Rooms have Objects. Objects are made from Sprites.
Objects have events.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-2-
7/14/2017
GAMEMAKER 7
B) Create wall objects
7.
Resources > Create Object
8.
In the Objects Properties box pick the
sprWall sprite from the pull down
menu, as shown in the screenshot
9.
Name the object objWall
10. Check the solid check box
11. Click OK to close
C) Define a room
12. Resources > Create Room
13. Click on the Settings tab of Room Properties
14. Make Width: 240 and Height: 240
15. Set both SnapX and SnapY to 24, because the wall sprite has both a
width and height of 24
16. In the Caption box type in Level one.
17. Name the room, Room One
18. Click on the Objects tab of
19.
20.
21.
22.
23.
Room Properties
Select the wall object from the
pull down menu
By left clicking in the room place a wall object in there
Keep clicking to build the whole wall around the room. To build the wall
quickly try shift + hold down left mouse button + drag mouse.
Use the right mouse button to remove bits of the wall you don't want
Click on the tick to close.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-3-
7/14/2017
GAMEMAKER 7
D) Create ball objects
24. Resources > Create Object
25. In the Objects Properties box pick the sprBlueBall sprite from the pull
down menu
26. Name the object objBlueBall
27. Check the solid check box
Keep the Object Properties window of the ball object open
E) Program Events
In the middle of the ball Object Properties
window you'll see the Add Event button
28. Click the Add Event button
29. Click Create from the Event Selector pop
up menu
On the right hand side you'll see all the
possible actions in a number of groups
(tabs)
30. From the move tab choose the Action
with the 8 red arrows and drag it to the
list in the middle
31. Now click all of the 8 arrows to
randomize the initial motion
32. Change the speed to 2
33. Click OK to close
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-4-
7/14/2017
GAMEMAKER 7
Keep the Object Properties window open. Program the collision of the ball with
the wall:34. Click Add Event and this time
choose Collision from the Event
Selector
35. From the drop down menu of the
Collision Event select objWall
36. From the actions on the right
select the bounce against objects
icon and drag it to the list in the
middle
A window will pop up, called
bounce against objects
Don’t change anything, just
click OK
37. Add Event > Event
Selector > Mouse > Left
button
Find Set the Score on the Score tab on
the right hand side
38. Drag Set Score to the action list in
the middle
39. For the score action, type in the
value of 1 and check the Relative
box. This means that 1 is added to
the current score for each successful
mouse click.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-5-
7/14/2017
GAMEMAKER 7
Stay on the left button Event
40. Click on the move tab on the right hand side
41. Find the jump to a random position button on the right and drag it to the
list in the middle. Click OK.
42. Click on OK to close the Object Properties
F) Add two ball objects
43. Reopen Room One
44. Add objBlueBall
45. Finally place 2 ball
objects in the room
46. Click on the tick to
close
G) Play the game
47. Press the Run Game
green arrow
48. Click on the moving
balls with the left
mouse button and see
what happens
49. Stop the game by pressing the
<Esc> key
50. Save your game if you haven’t
already, call it something like
xyclickball1.gm6 where xy are your
initials.
H) Including Game Information in
your program
51. Open the game information panel.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-6-
7/14/2017
GAMEMAKER 7
52. Enter in your text as you would a normal word processor. This should be
the same information (therefore you can cut and paste) as described in
your game design.
53. To make the code come up
when your game starts, enter
the following code into the
Room Creation Code.
54. Save and run your game to
test.
CONGRATULATIONS!
YOU HAVE MADE YOUR FIRST GAME!
RESOURCES:
Game Maker official site
National forum
Kerr web site
Forster club
EdNA groups
Game Maker Forum
http://gamemaker.nl
http://lyris.education.tas.gov.au:8080/read/?forum=gamemaker
http://intranet.woodvillehs.sa.edu.au/kerrbi/g/int.htm
http://edrington.haileybury.vic.edu.au/computerclub/computerclub/index.html
http://www.groups.edna.edu.au/course/view.php?id=81
http://forums.gamemaker.nl/
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-7-
7/14/2017
GAMEMAKER 7
I)
55.
56.
57.
58.
59.
60.
61.
62.
Add a sound
Resources > Create Sound > Load Sound
Button > Sound Folder > beep1.wav > Open
Test the sound by pressing the green play
button
Name the sound beep1
Double Click on objBlueBall to open the
Object Properties.
Select the Left Button Event
From the actions on the right hand side click on the main1 tab
Drag “play a sound” to the middle
Select the beep1 sound from the pull down menu
63. Click OK, then OK.
64. Save and then test your program by clicking on the green arrow.
Other things you can do
65. Change the speed of the ball object
66. Add in more wall pieces
67. Change the value of the score
Before moving on to the next stage of learning, you need to be more than
just a programmer who follows someone else’s instructions. So to make
you an expert, you need to be able to build this simple game by yourself
without any help from the instructions and them make modifications to it.
Over the page will be some different configurations of the game that you
need to construct. Remember that your first game only took you 30
minutes to build. You will be as fast or faster the next time around.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-8-
7/14/2017
GAMEMAKER 7
The Pyramid
What you will need to change
Height = 240
Width = 480
The Ice Cave
What you will need to change
Height = 240
Width = 480
The Rock Wall
What you will need to change
Height = 720
Width = 360
New Bear Sprite
New Ground Sprite
The Swimming Pool
What you will need to change
Height =360
Width = 720
New Bear Sprite
New Pool Sprite
New Ground Sprite
68. Save each game separately with a new name. Remember to include your
initials.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
-9-
7/14/2017
GAMEMAKER 7
Choose any of the games you have created to date and continue
adding the following to your memory and your game.
J) Moving to a new room
69. Create a new room (see instructions Section C on page 2)
70. Name your room Level 2
71. Go to the Ball Object > Left Pressed mouse event
72. In the score tab, drag over the “Set Score” into the Actions window.
73. Set the properties of the score action to include a cutoff value based on
how much you think is a fair score.
74. In the main1 tab, drag over the “Go to a different room” into the Actions
window
75. Set the properties of the new room to “Level 2”
76. Apply a transition. For instance “Create from left”
77. Click on “Ok” to close the properties window and “Ok” to close the
Object properties window.
78. Run your code to test.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 10 -
7/14/2017
GAMEMAKER 7
K) Creating a message box
79. To communicate to your player, you can use a message box. Place this
at the point you want the message to pop up. In this case, just before
you move to your second room, which is in the Left Pressed Mouse
event.
80. Select Main2 tab and drag
the “Display message”
instruction from the Info
section, into the Action
window. Write your
message in the box.
81. Make sure your Display a
message instruction is in
the best logical position for
your game.
82. To make both instructions
only occur when the score is
equal to 200, you need to
add in a Start and End Block
instruction set to group the
instructions. You will find
these on the Control Tab.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 11 -
7/14/2017
GAMEMAKER 7
L) Programming Function Keys
83. Choose an object which appears in all rooms (like a
wall) and add an event to it.
84. From the event selector, choose “Keyboard” then
“Function Keys” then F2. (F1 is already used to
display the instructions).
85. From the Main1 tab, choose “Different Room”
86. Select the new room you would wish to move to as
well as a transition, and
click on OK
87. You may like to do one
to go to the next room
and one to take you
back.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 12 -
7/14/2017
GAMEMAKER 7
M) Using the Keyboard arrow keys to move an object
88. Select the object you want to move.
89. In the objects properties, add a keyboard event for <Left>.
90. Make the action “Jump to a given position” and place -4 as the x value
and apply that to “Self” and make the action “Relative”.
91. For the same object, add another Keyboard event for the <Right>, with
the Action being “Jump to a given position” and an X value of +4. Again
making it apply to “Self” and making it “Relative”.
92. If you want the object to move up and down, then you would repeat
these steps, only leaving the “X” values at zero and setting the “Y”
values as “-4” for the “Up” key and “+4” for the “Down” key.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 13 -
7/14/2017
GAMEMAKER 7
N) Shooting Darts and Hitting Balloons
93. Create 3 sprites. SprShooter, SprDart, SprBallon. You may need to draw
your own, or modify existing sprites.
94. Add 2 sounds, Boink2 and Beep2 and call them sndboink2 and sndbeep2
95. Create 3 objects, one for each sprite.
Apply the actions as shown relative to each object.
Name
Sprite
Event
objTeddy
Left keyboard
Jump to a given position
X:-4 relative
objBalloon
Create event
Start moving in a direction,
down, speed 2
Right keyboard
Jump to a given position
X:+4 relative
Press Space
Create an instance of
objDart
Applies to self and relative
objDart
Create event
Start moving in a direction,
up, speed 20
Play sound sndbeep2
Collision with objBalloon
Destroy the instance
Applies to other
Set the score relative to 1
Play the sndboink2
Collision with objDart
Destroy the instance
Applies to self
96. Test
No games are to be created where any animal from any species (including
humans) are to be hit or shot at. Therefore there will be no blood or body
parts depicted in any game created. A breach of this rule will result in the
deleting of the game and consequences similar to the breaking of any
school rule.
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 14 -
7/14/2017
GAMEMAKER 7
O) Changing an object after it has been hit
97. To create an explosion when an object has been destroyed, you need to
change the object that has been hit by the dart into the animated
graphic of explode.gif. This sprite can be found in the sprites folder
under various.
Name
Sprite
Event
objExplode
Other  Animation End
Destroy instance (self)
objDart
Create event
Start moving in a direction,
up, speed 20
Play sound sndbeep2
Collision with objBalloon
Change instance with
objExplode (main1 tab)
Add this code
into ObjDart
Collision with
objBalloon
Destroy the instance
Applies to other
Set the score relative to 1
Play the sndboink2
Collision with objDart
Destroy the instance
Applies to self
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 15 -
7/14/2017
GAMEMAKER 7
P) Using view to create spaces larger than the window size
specified
98. Choose Advanced mode from the File Menu
99. Your room dimensions can be larger than the window you will view them
in. This way the game field of view can be hidden by the user, until the
object being played interacts with other elements of the game.
100. This room is 1800
pixels wide, and
480 pixels high.
This is a lot larger
than the screen
size and the
window the game
needs to operate.
101. Draw your room
and add all the
elements your
room needs. For
instance, walls,
objects that can
be moved, and objects that will be interacted with. The actions of these
will be the same as they would be normally.
102. Change to the “Views” tab and tick the following boxes.
a. “Enable the use of Views”
b. “Visible when room starts”.
c. View in Room. Enter “H(eight)” and “W(idth)”. This determines the
size of your game window. X and Y values indicate the top left corner
position of the port.
d. Port on Screen. Enter “H(eight)” and “W(idth)”. This determines the
size of the Port, which is the viewable area. (Note: If the dimensions
of the port on screen are bigger than the view in the room, a zoomed
in view of the game is created). Leave the X and Y values at zero.
This merely shift the port location in the window.
e. Object following. Select from the list the object in your game you
wish the port to follow.
f. Enter in values to produce a buffer (like an invisible shield around
your object) “Hbor” and “VBor”, “Hsp” and “Vsp” to determine the
maximum horizontal step the object makes.
103. You should see a solid border around an area on your room. This is the
size of the port.
104. Example of some completed View values
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 16 -
7/14/2017
GAMEMAKER 7
875099280
Adapted from Bill Kerr’s Clickball Basics 50 Steps
- 17 -
7/14/2017