Controls:

WASD

This is a project demonstration for the plugin Top Down Enemy State Machine.

This project demonstrates how:

- Enemy switches from `IDLE` state to `WANDERING` state

- Enemy switches from `WANDERING` state to `ALERT` state

- Enemy switches from `ALERT` state to `CHASE` state

How to use the Game Maker Studio Package:

1. Download project-top-low.yymps

2. On your Game Maker Studio, click on Tools in the menu bar

3. Click on Import Local Package

4. Select the downloaded project-top-dow.yymps from the File Explorer

5. Import the NotesObjects, and Scripts

How to use the scripts:

1. On your initialization room `rm_init`, add an instance of `Objects > Init > obj_init_enemy`

- This object will be handling all initializations for this package

2. To create new enemy, make an Object and set the parent to `Objects > Enemy > obj_enemy`

- This will allow your enemy to switch between the states of being idle to wandering

- In order for you to trigger the alert and chase state, add the `Objects > Characters > obj_character` into the room

Note:

In addition the basic instructions, you can make adjustments on the the enemy states such as move speed,

the time frame when the enemy switch states etc.

Take note of the descriptions below to understand how each of the enemy object variable definitions:

state - This is the variable where the current state of the enemy is stored. Defaults to ENEMY_STATES.IDLE macro

state_change_counter - The variable that increments every step. Defaults to 0

state_change_frames - The total amount of frames when the enemy switches from idle to wander or alert back to wander. Defaults to ENEMY_STATE_CHANGE_FRAMES macro

move_speed - The speed of the enemy when chasing the player. Defaults to ENEMY_MOVE_SPEED macro

wandering_direction - The variable where the wandering direction will be stored. Defaults to `undefined`

wandering_speed - The speed of the enemy when wandering the area. Defaults to ENEMY_WANDERING_SPEED macro

alert_radius - The radius of the enemy to be alerted when the player gets into. Defaults to ENEMY_ALERT_RADIUS

alert_state_counter - The variable the alert state counter is stored. Defaults to 0

alert_state_frames - The number of frames when the player stays within the alert radius, the enemy state switches from being alert to chase. Defaults to ENEMY_ALERT_STATE_FRAMES

chase_state_counter - An incremental counter while the enemy is chasing the player

chase_state_frames - The number of frames the enemy will chase the player while outside the chase radius before switching back to alert. Defaults to ENEMY_CHASE_STATE_FRAMES

chase_radius - The radius of the enemy chase before switching to alert. Defaults to ENEMY_CHASE_RADIUS

state_scripts[] - An array that will hold the states of the player

sprites[] - An array that will hold the sprits of the player in conjunction to the state scripts


StatusReleased
PlatformsHTML5
Release date 81 days ago
Authormaikforte
Made withGameMaker
TagsGameMaker
Code licenseMIT License
Asset licenseCreative Commons Zero v1.0 Universal
Average sessionA few seconds
LanguagesEnglish
InputsKeyboard
AccessibilityInteractive tutorial

Download

Download NowName your own price

Click download now to get access to the following files:

project-top-low.yymps 48 kB

Development log

Leave a comment

Log in with itch.io to leave a comment.