0% found this document useful (0 votes)
25 views2 pages

Activity - GameMaker - Finite State Machines

Uploaded by

PAVAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Activity - GameMaker - Finite State Machines

Uploaded by

PAVAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ITCS 4230/5230 - Fall 2024

Introduction to GameMaker: Finite State Machines


ITCS 4230/5230
This activity is designed to increase proficiency in the use of the GameMaker programming Language
(GML) to implement finite state machines. The project includes a significant amount of sample code.
Make sure to carefully examine the code provided and to understand what it does.

Learning Outcomes
By the end of the workshop students will be able to:

1. Implement simple scripts using GML


2. Use the enum data type to implement States for a Finite State Machine (FSM).
3. Understand how to implement a state machine to:
a. Handle character movement
b. Use momentum to push a block
c. Make the character show off with a dance

Setup
1. Read about the enum data type in the GameMaker Studio documentation:
https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Overview/Data_Types.
htm
2. Download the file named BasicStateMachines.zip, which is linked from the assignment on
Canvas.
3. Import the project and to run it. The game runs, but is hardly functional.

The Player Object:


1. The player controller object needs to declare a
variable named states with the following enum
values: Regular, Pushing and Dancing.
2. Check the ‘Variable Definitions’ section for
obj_player, down below ‘Events’, ‘Parent’ &
‘Physics’. The variables defined there are special
in that it is very easy and convenient to change
their values.
3. Read through all of the events; use the
comments to help you understand what the code does. Pay special attention to the TODO tags in
the comments.

Copyright © 2017 - 2024, Julio C. Bahamón, Martin Gutierrez and Riley Jones, UNC Charlotte
All Rights Reserved.
ITCS 4230/5230 - Fall 2024

4. Note that there are TODO sections in most of obj_player’s events. You will need to write code
in these sections to enable full player functionality. Try to reference surrounding code if you
need some guidance. You can use CTRL+F to find all the TODO sections in a given event.

The Block:
1. obj_block doesn’t have any code in it, actually. It has an empty collision event with other
obj_blocks though. Since they are solid, the collision event will prevent two obj_block from
overlapping.

The Room:
The room has two blocks in it. obj_player is also positioned inside the room. Use this to test your
game and make sure functionality is correct.

You do not need to make any changes to the room configuration.

The Result:
obj_player will walk around as expected. When close to an obj_block, you should see a prompt
indicating to press the ‘E’ key. If you press the ‘E’ key then, obj_player will start pushing the nearby
block on either the x or y axis. Pressing ‘E’ again will stop pushing.

Most importantly, pressing ‘Space’ will cause the player to start dancing, and they will be unable to
perform any other actions while doing so.

Copyright © 2017 - 2024, Julio C. Bahamón, Martin Gutierrez and Riley Jones, UNC Charlotte
All Rights Reserved.

You might also like