Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Content

Episode 31! We're finally back to the week-ahead release schedule for however long it lasts.

Public to the wider world next Friday. Source code will be updated asap after I finish this post.

Files

Previews only

GameMaker Studio 2: Action RPG Tutorial (Episode 31: Player Death)

★ Source Code ▶ https://shaunjs.itch.io/shauns-action-rpg-tutorial ★ Playlist ▶ https://www.youtube.com/playlist?list=PLPRT_JORnIuosvhfax2TQTEmN7OYTcSvK ★ Support my work ▶ https://www.patreon.com/shaunjs ★ Assets & Sprites ▶ http://shaunspalding.co.uk/ARPG_Assets.zip ★ Resolution & Aspect ratio guide by Pixelated Pope ▶ https://www.youtube.com/watch?v=jCl6zT0eQLU Learn to build a zelda like action RPG in GameMaker Studio 2, starting from nothing at all. Today we learn how to implement a failure state when our player runs out of health! These tutorials are supported almost wholly by wonderful people via Patreon, click the link above to join them and access these episodes as early as possible, get instant access to source code for all videos and more.

Comments

Anonymous

I am interested in the logic behind quests and game story. How are game states saved so that quests that have been completed stay completed. I assume global game object variables are created to keep track of every state? Weapon and armor unlocked, quests completed, whether an area has been explored already and so on. Thanks for the tutorials and keep up the good work. I have learned a lot.

Anonymous

To cause the enemy to stop attacking the Player when it's dead I added "&& (oPlayer.state != PlayerStateDead)" to the end of the aggro check in the Wander state. I also added a line in the Attack state after the last "else" statement to stop the attack: "if(oPlayer.state == PlayerStateDead) state = ENEMYSTATE.WANDER;" I dunno if this is the most efficient way to do it, but it appears to work, and doesn't cause any other issues...for now. Do you foresee any problems?

shaunjs

Hi video9, the video in question is out now so I assume you know the answer now! But yeah, just using globals for this is fine (or rather, a global array/data structure). It's so frequent in a game like this to want to query quest status that it's a perfect use case for globals.

shaunjs

The logic is correct but the implementation here has two small issues: 1. relies on an instance of the player object existing (might be a reasonable compromise tbh, I think a few things might rely on this due to my laziness) 2. is something you might find yourself having to do a lot, so would be better served by a function! It's a perfectly reasonable and common situation to want to check so what I'd recommend is creating a "IsPlayerDead" function your enemies can use that checks if the player exists *and* if they're not dead. That way you can call that and not have to repeat the line and if you want to adjust or expand it later you can do it in one place.