timer problem

Get help using Construct 2

Post » Tue Oct 29, 2013 1:44 pm



Bomb is thrown by PirateWithBomb upwards then falls down on ground.

What I want to do:
I want the bomb to change animation to "OnGround" and start a one second timer before destroying itself and spawning explosion object.

Problem:
The explosion object is already spawn just as bomb is falling down (which I already counted as 1 second AFTER the bomb was spawned by PirateWithBomb).

How can I make it work like I wanted it to?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Oct 29, 2013 1:54 pm

Does the bomb also change to OnGround while falling ?
B
46
S
16
G
77
Posts: 2,159
Reputation: 45,833

Post » Tue Oct 29, 2013 1:59 pm

At least you should switch the bomb destroy and bomb spawn action, If the bomb explodes earlier then expected it's not in these events.

Why does the bomb have platform behaviour? Does it walk and jump?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Oct 29, 2013 2:12 pm

@plinkie

No. The OnGround animation plays when the bomb has landed on the floor (which is correct). But the timer is starting as soon as the bomb is spawned.

these are all the codes of PirateWithBomb



Just to recap how it is supposed to work:
Bomb is spawned at frame 2 (binded at frames 2 and 3). Bomb should NOT explode while in frames 2 and 3 of PirateWithBomb. Bomb is thrown upwards and then falls down on floor. Bomb should play animation OnGround as soon as it lands on floor. Bomb should start a 1-second timer to destroy itself and spawn explosion.

The bomb should destroy itself and spawn explosion upon contact with playerBox anytime AFTER frames 2 and 3.

Also, some other issues:
- the bomb thrown already "seems" to go back to being bind to PirateWithBomb after it was thrown. I want the bombs (individually) to not be controlled/bind after frame 3 (or AFTER it was THROWN) of PirateWithBomb


@LittleStain
What's a good replacement for platform behavior based on the intended use?

Nope. The bomb is just thrown. It doesn't walk or jump. I have tried simulating jump to make the bomb go up, but it did not work, so I used vector X instead.

I thought of using platform because I thought I needed the condition "On landed" or "Is on floor", but either of those don't work.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Oct 29, 2013 2:14 pm

also, another issue is when the PirateWithBomb is spawning the bomb at frame = 2, if I REMOVE the "Every X seconds" condition, the PirateWithBomb spawns like multiple bombs all at once.

I just want a single bomb spawned at the first tick of the frame 2.

Did I do it right?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Oct 29, 2013 2:16 pm

Change OnLanded to on collision with the floor object and see if it's still broken.
B
46
S
16
G
77
Posts: 2,159
Reputation: 45,833

Post » Tue Oct 29, 2013 2:28 pm

@plinkie
ok. tried it. did not worked.

I noticed something. Right now, the PirateWithBomb is throwing the bomb at a stairway. If the bomb falls on a lower ground level AND the PIratewithbomb is already in frame = 2 AGAIN, the bomb binds back to Piratewithbomb (and not play OnGround)
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Oct 29, 2013 2:55 pm

I don't like this logic being triggered by animation frame. If the player moves the character or in future you allow the player to do different things that cut the throw anim out halfway through all the logic is gonna mess up. I would set up some functions for throwing the bomb then detecting if it hits the floor and destroying it. You have a load of different logic hooked up to when animation frame = 2 as well which could be causing conflicts. I would definitely avoid using the anim frame stuff to trigger this fairly simple logic.
B
46
S
16
G
77
Posts: 2,159
Reputation: 45,833

Post » Tue Oct 29, 2013 3:00 pm

And don't forget picking the bomb you want to affect in your event.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 23 guests