Collision triggering one event at a time

Get help using Construct 2

Post » Sat Sep 29, 2012 10:16 pm

Getting there!

Problem is, if I try to run the second event, they run at the same time.

I added a wait 3 second to the second event and now it waits to run, but it run automatically after three seconds, even if you move the player out from the collision with the falling block.

Here's an updated Capx, with movement for the player and the wait added in.

fallingTest3.capx
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Sun Sep 30, 2012 7:37 am

Right now, I do not understand the problem

But what I definetly can say is, that you haven't understood the Event-Paradigma C2 is based on. Maybe you should start with some of the tutorials to get the hang of it.

In your last CAPX you have two events, that will be triggered at the same time:



Therefore you will get strange results!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sun Sep 30, 2012 8:50 am

[QUOTE=Kyatric] Following exactly what you're asking in the post above here is a capx.[/QUOTE]

I'm gonna go and take another swing at understanding this a bit better Kyatric. I think of everyone you've come the closest, but I don't have much experience with UID's or whatever they are o.9

[QUOTE=Yswellin] This is what I want:

On the first collision, the first sprite goes from transparent to whatever (in this case 0)



On the second collision, the second sprite goes from transparent to whatever (in this case 1)



On the third collision, the third sprite goes from transparent to whatever (in this case 2)



That's what I would like. I can;t seem to figure it out :/

Thanks guys![/QUOTE]

@Weishaupt:

Yes, I need those two events in the picture you posted above NOT to be triggered at the same time. I need them to be triggered by the same CONDITION, which is the red box colliding with the green box.

There must be second condition to make them run separately, because as you say, now they are running at the same time, but I don't know what that condition is. That is what we are looking for. That's the problem.

The other problem is how to make it such that the red falling blocks keep spawning until each sprite on the right has changed frame.

For what I want in terms of what the problem is, see my quote above.

I really appreciate all the help you've given me thus far everyone. I'm learning a lot!
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Sun Sep 30, 2012 9:03 am



this will prevent the events to be triggered at the same timeWeishaupt2012-09-30 09:03:25
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Oct 01, 2012 1:45 am

WAIT 3.00 seconds is what is preventing it from triggering it at the same time. If you move the green player rectangle out of the way of the second falling block, the event still runs, even though the player and the falling block are not colliding :/
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Mon Oct 01, 2012 1:54 am

[QUOTE=Kyatric] Following exactly what you're asking in the post above here is a capx.[/QUOTE]

Not surprisingly, this works. Two questions:

How would I get it to stop spawning falling blocks when the third sprite is switched?

Is there a way you can think of to make the falling block and the sprite face match? For example, if the fallling block was blue, then on collision it would turn the sprite on the right blue as well. I'm working on figuring this out, and had done so before, but I don't understand instance variables very well, or currFrame, so it's like having to relearn it :3

Thanks again!
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Post » Mon Oct 01, 2012 2:19 am

Add an instance variable to the falling block. Call it whatever you like, something that makes sense like fallcounter for example. Set the variable as a number and the value to 0. Each time the block hits the square, add one to the variable.

Create a check for that number being equal to 3. If it is, destroy the block. This will of course stop it falling. To get it started again, just create a new on when you need it.

I can't create a CAPX to show you because I can't find how Kyatric has set the box to drop! Unless it's because I have the free version and I can't see the event. Can you explain how you got the block to reset each time it dropped Kyatric?

I found out how (using he WRAP behaviour). I've changed the CAPX so it checks the number of the instance variable (of the falling block) and destroys the block if it equals 3 (remember it counts from 0 so 0,1,2 is makes it fall 3 times).

EDIT - I've changed the CAPX again so this time it will randomly select a number and set the animation frame of the blocks to that number. Instead of doing it that way, you could make the same animation frames for the falling block, then on collision with the player set the animation frame of the number block to match the number of the falling block.

That way, if a number 3 falls and the player touches it, set the fading in block animation frame to 3 and it all ties in. If I'm not making much sense it's because I'm tired, I need my bed lol.

CAPXvandinz2012-10-01 02:54:53
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Mon Oct 01, 2012 10:16 am

Wow. Exactly what I needed. Awesome! You just got rid of like 90% of my stress!

Thanks so much everyone! I knew you guys would help :3
B
16
S
3
G
3
Posts: 66
Reputation: 3,629

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests