Ex: The Collector
Setup Layout
Setup game defaults
SD Landscape 16:9
854 x 480
Use default settings
Set size of
Layout 1
to match 854 x 480
Setup Layers
Separate game characters from background layers
Select
Layer 0
change name toBackground
Change
Background color
property ofLayer 0
Pick any color you like
Create new layer named
PlayerLayer
Main Character
Create and add main character
On the
Player
layerCreate and add a new
Sprite
objectName the object-instance
TheCollector
Resize Image Canvas
to 100 x 100 pixelsDraw your character
Behaviors: Movement
Add behaviors to main character
Select
Player
instanceProperties panel
Behaviors
->Add new behavior
Select / search for
8 Direction
Take note of default controls
Change and experiment with
Max Speed
,Acceleration
, etc.e.g. higher
Deceleration
for quick stops
Experiment with `Set angle
What kinds of games can you make with these limitations?
Behaviors: Bounding
Prevent player from leaving viewport
Select
Player
instance againProperties panel
Behaviors
->Add new behavior
Select / search for
Bound to layout
From properties panel
property
Bound by
value
Origin
Keyboard Object
Invisible Object to make keyboard controls possible
Go to
Player
spriteBehaviors
->Default controls
-> Uncheck
Insert invisible
Keyboard
object to project
Events: Keyboard Controls
Disable default controls. Reassign keyboard controls.
Go to
Event sheet 1
sheetCondition:
Keyboard
object ->Key is down
-> pressW
key
Action:
Player
->Simulate control
->⬆︎
key
Repeat these Conditions and Actions for:
A
is⬅︎
keyS
is⬇︎
keyD
is➡︎
key
Event: OR Blocks
Move player with WASD keys OR arrow keys
Go to
Event sheet 1
sheetSelect
W
key condition -> right-clickMake OR block
Right-click
Add
->Add another condition
Keyboard
object ->Key is down
-> press⬇︎
key
Repeat these Conditions and Actions for:
A
isLeft
keyS
isDown
keyD
isRight
key
Event: Organization
Organize with folder and comments. Write to your future self.
Go to
Event sheet 1
sheetIn empty areas, right-click
+ Add Group
-> namedKeyboard Controls
Select all four keyboard events and drag into the Group
Select Group
Keyboard Controls
-> right-click+ Add Comment
-> add comment "Custom controls to the player" or whatever you like
New Object Sprite
New object sprite to be a token, enemy, collectible, power ups, etc.
Go to
Layout 1
sheetInsert new object
->Sprite
Resize to 50 x 50
Draw anything for the sprite
Name/rename sprite to
Token
Event: On start of layout
On start of layout
When the game starts, randomly place tokens.
Go to
Layout 1
sheet remove Token sprite from LayoutNow, go to
Event sheet 1
sheetIn empty areas, right-click
+ Add Group
-> namedSystem
Condition:
Add Event
->System
->On start of layout
Action:
Add Action
->System
->Create object
-> SelectToken
Layer:
"Player"
Prevent being placed off screen
X:
random(50,834)
50 is width of Token
Note: 834 is width of Layout minus Token sprite width
Y:
random(50,470)
50 is height of Token
Note: 834 is height of Layout minus Token sprite height
Check-Check: Game Loop
Update the game every second aka tick.
Note:
On start of layout
initially runs once versusEvery tick
once a second.Go to
Event sheet 1
sheetTest condition for the Game Loop
Condition:
Add Event
->System
->Every tick
Action: Copy Action from above to randomly place Token
Does it create and randomly place Tokens on screen?
If yes, delete test condition
If no, fix, then delete.
Timer Function
Functions are named and reusable events
Go to
Event sheet 1
sheetIn empty areas, right-click
+ Add Group
-> nameMy Custom Functions
In empty areas, right-click
Add Function
Condition: New named function
CreateToken
Action: Copy Action from above to randomly place Token
Put in
My Custom Functions
group
Modifying Each Instance
When each instance is created, modify the instance.
Go to
Event sheet 1
sheetIn
My Custom Functions
groupCreate a single condition with multiple actions
Condition:
Token
->On created
Action:
Token
->Set angle
->random(0,360)
i.e. between 0 and 360 degreesAdd a second Action
Token
->Set opacity
->random(20,100)
i.e. between 20% and 100% opacity
Add a second Action
Token
->Set scale
->random(.5,15)
i.e. between 50% and 150% opacity
Player vs Tokens Layer
Separate the Player layer versus Token layer
Go to
Event sheet 1
sheet ->Layers - Layout 1
panelright-click ->
Add layer at top
rename to >
TokensLayer
order Layers top to bottom
PlayerLayer
TokensLayer
Background
Go to
CreateToken
function, double click on the ActionSet
Layer
to"TokensLayer"
to ensure the Player is on top of the Tokens
Player Destroy Tokens
Object to destroy other objects
Confirm Layers are in correct order
Confirm Tokens spawn to
TokensLayer
Add new Event
Condition:
Player
->Is overlapping another object
-> selectToken
for objectAction:
Token
->Destroy
Variables to Keep Score
Keep track of destroyed objects
Go to
Event sheet 1
sheetRight-click ->
Add global variable
Name
isScoreCount
Type
isNumber
Inital Value
is0
Global variables are added to the top of the sheet
Go to Event for
Player
isOverlapping another object
Add a second action
System
->Add to
->Score
->Value
is1
add one to the score
Text Object to Display Score
Go to
Layout 1
sheetAdd
Text
object -> rename objectTheScore
Go to
Event
sheetGo to Event for
Player
isOverlapping another object
Add a third action
TheScore
->Set text
->ScoreCount
Custom display of the score
"Score: "&ScoreCount
show static text "Score: " then append with&
the dynamicScoreCount
HUD Layer
Put score on it's own layer.
Go to
Event sheet 1
sheet ->Layers - Layout 1
panelright-click ->
Add layer at top
rename to >
HUD
Go to
Layout 1
Select
TheScore
Changer
Layer
property toHUD
Last updated