Best way to track what the player has done?

Get help using Construct 2

Post » Sun Jun 17, 2012 10:03 am

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.Awakening2012-06-17 10:08:42
Posts: 150
Reputation: 1,747

Post » Mon Jun 18, 2012 12:06 am

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
Posts: 5,238
Reputation: 67,762

Post » Thu Jun 21, 2012 12:32 pm

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.
Posts: 150
Reputation: 1,747

Return to How do I....?

Who is online

Users browsing this forum: DarknessGamingDK, webebiz and 1 guest