Best way to track what the player has done?

  • I want different NPC's to give greetings, be in different positions and have objects exist or not in a layout depending on a players actions.

    I assume the system would be similar to "if player collides with <sprite> and <sprite> falls, <sprite> will be destroyed upon returning to that layout because the value has been changed"

    Any tutorials available for this kind of event tracking in C2?

    A specific example would be:

    The player knocks a squirrel out of a tree, once the squirrel lands, the player can talk to the squirrel, who will say a variety of things. Once the player leaves the layout, the squirrel will no longer be present, even if the player returns.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The typical way to do this is with instance variables. I'd use a text variable and call it state.

    It would be values like:

    in tree

    on ground

    talked to

    wet and angry

    Then you could just use events to compare the current value of "state".

    For the persistence aspect I'd use the webstorage object to save/load the object's state:

    +On start of layout

    +Webstorage: Local key "squirrel" exists

    ---- Squirrel: set state to WebStorage.LocalValue("squirrel")

    +On end of layout

    ---- Webstorage:set local key "squirrel" to squirrel.state

  • Thanks, are there any tutorials on this kind of thing for construct 2? I saw the RPG tutorial, but I think that was CC not C2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)