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.
Comments
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.
2021-01-12 17:21:38 +0000 UTC
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.
2021-01-12 17:16:04 +0000 UTC
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?
2021-01-03 03:31:39 +0000 UTC
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.