Stop event from occurring again?

Get help using Construct 2

Post » Thu Jan 03, 2013 5:31 am

Hi,

Basic event system question. I'm new to C2 and have no programming background.

I'm trying to create educational games for the classroom.

The basic user experience is: hear a command, do it. Hear another command, do it.

I created a crude example that highlights my problem with the event system.

For example: user hears, "touch the wine" and touches the wine, whereupon he hears an affirmative "good." User then hears, "touch the eggs." So he should touch the eggs and hear another "good." BUT...even if the user goofs and touches the wine (instead of the eggs)he still is rewarded with an affirmative "good." So the response to the verbal command no longer makes sense. This is because my prior event says that clicking or touching the wine creates the action of the audio playing "good." So I need to create that command-and-response kind of pattern but haven't been bright enough to figure it out for myself yet. Anyone care to set me straight?

Capx location: https://docs.google.com/open?id=0B7shV36L5wGXM2ZsRXl2bFYyVTA

Thanks in advance.

Erikerikpritchard2013-01-04 03:24:11
B
3
Posts: 7
Reputation: 589

Post » Thu Jan 03, 2013 9:24 am

Assuming you don't want to make invisible the objects as they're touched, your best way to keep track of the current objective would be with instance variables.

Your link gives me a 404, so I'll approximate what I mean:

Create an instance variable for each sprite, a boolean called "target" or something. Set to false to begin with. Then, along with each touch condition, create another condition that the sprite's target must be true to perform the actions.

Now what you want to do is create the mechanism for altering that boolean as you go along. For each new objective, you should nominate the next target by changing its variable to true. Then, when that object is touched, set its variable to false, play the sound and set the next objective's variable to true.

I've included a very rough capx so you can see what I mean: capx
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

Post » Fri Jan 04, 2013 3:25 am

Thank you very much for your reply...sorry about the bad link (fixed it tonight). Can't wait to look at your example!

Erik
B
3
Posts: 7
Reputation: 589

Post » Fri Jan 04, 2013 4:13 am

Brilliant! That's exactly what I was looking for! Thank you very much.

Erik
B
3
Posts: 7
Reputation: 589


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, theosciandra and 25 guests