Never *really* done

You're viewing a single comment in a conversation. View all the comments

  • Order by
  • Hey Laura_D, what you need is to focus on a FSM (Finite Stame Machine) approach to your game. I've created my own C3 plugins to make this easier, but you can implement it with simple instance variables and you will need a global variable for your whole game state. This is a simple and effective approach since all the actions depend on your object's state. For instance, if you NPC is being controller by the player, it may have the state "PLAYER_CONTROL" as a string in it, then if you trigger the dialog box you may change the state to "PLAYER_DIALOGUE", and in your event sheet you have to condition the "control handling" of the player to the state "PLAYER_CONTROL" so your game knows when you are either moving around, or seeing a conversation.

    I just implemented the same stuff I described for my last games and workload reduces a lot becuase your conditions to trigger more stuff in the game depends on a state, instead of tons of variables and animations.

    Hope it helps

      • [-] [+]
      • 1
      • Laura_D's avatar
      • Laura_D
      • Construct Team Community Manager
      • 1 points
      • (1 child)

      Hi Sotano,

      Appreciate the input, but I'm already using states - we had this discussion on stream a few weeks ago! I just hadn't put them in for the player, only NPCs.

      • That's actually very handy... for instance, an "Active" state for the player lets the user move, jump, run, use his power ups... then when you receive damage you change the state to "Damage" and you may inactivate the controls and throw the player a couple of pixels away like receiving an impact, then return to "Active" and enable movement again. And for special powers they may be "sub-states" of the main "Active" state. Is usefull also for handling animations with more complex effects. When I did this I first used instance variables for my objects, and months later I was able to develop a behavior and a plugin for handling the whole game state and each object's state.