Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411505 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 09:21:55 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Turn-based RPG battles in GM:S?
Pages: [1]
Print
Author Topic: Turn-based RPG battles in GM:S?  (Read 563 times)
Crabby
Level 2
**



View Profile
« on: August 01, 2015, 06:39:14 PM »

I'm just curious how I could change from one game state to another, while also keeping stats of characters. Would I use global variables so everything is defined?
If anyone has any example code to help me out, I would be grateful.
Logged

Working on something new!
Follow me @CrabbyDev.
mokesmoe
Level 10
*****



View Profile WWW
« Reply #1 on: August 01, 2015, 10:44:47 PM »

You will need either global variables or a persistent control object to keep track of stats through room changes. Keeping every stat as it's own variable would be messy this way though, (assuming you have more than one character with stats to keep track of) so I'd recommend using some sort of data structure. A "map" should be the best one for this, as you can just use stat names to keep track of each stat.
Logged
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #2 on: August 03, 2015, 05:27:01 AM »

Yeah, use persistent objects for things like inventory and character equipment. For battles, what I do is create a "battle_obj" object and spawn one every time a battle starts. It freezes everything in the room and spawns all objects needed for the battle to take place, like backgrounds and characters. Whenever battle_obj is destroyed, it destroys every other instance involved in the battle code and unfreezes everything else, so everything is as it was before the battle took place.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic