Is Falling on platform doesn't always work

Get help using Construct 2

Post » Tue May 17, 2016 5:40 pm

I have a platform game started and my character needs to be able to jump onto an animated sprite. The sprite is simulating an object jumping or a wall going up and down.

When my hero jumps onto its head, I want it to be destroyed. Just like the basic enemies in super Mario.

My problem is sometimes when the animated enemies is not in animation, it doesn't catch the Is Falling flag.

Image

Image
B
8
S
2
Posts: 14
Reputation: 506

Post » Tue May 17, 2016 6:11 pm

I am a bit suprised that it works at all. Because, when the collision is happening it is done with falling.
That logic is flawed.

Did you check the collision polygones? Do they grow with the animation (and shrink) ? That would explain why it sometimes does work. Because the animation, when it goes from frame 2 to frame 1, schrinks the collsion polygones on the moment it dedected a collsion, therefor it goes falling again.

A better way of dooing this is with ONLY a 'is overlapping at offset' with y = 15 pixels or so. Dunno how big your objects are.

More about those collision polygones animating. Imagine an object 1 pixel above animation fram 0. All is fine. No solids stuck in eachother. Then it animaties (like poof, in big steps) to animation frame 2, and suddenly the solids are caught up in eachother. Got to watch that, dangerus, errating movements as result.
B
33
S
18
G
28
Posts: 2,462
Reputation: 20,888

Post » Tue May 17, 2016 7:12 pm

The collision polygons are different for each frame. They match the blue square in area.

I am unsure of what is flawed. I will have to re read what you wrote a few times.
B
8
S
2
Posts: 14
Reputation: 506

Post » Tue May 17, 2016 7:41 pm

Ok an easier method is this

1) Make an invisible sprite and have it under your sprite

2)Then when the invisible sprite collides with the enemy , it destroys the enemy.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Tue May 17, 2016 7:44 pm

Download my capx. file here to see how I use the invisible sprite . Its not exactly what your doing but it shows how I use it with collision events.

https://www.scirra.com/tutorials/5343/h ... -game-capx
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Tue May 17, 2016 7:49 pm

An 'is falling' under a 'on collision' can not work = flawed logic. Because when the collision happens it cant be in a state of falling after the collision check.

It works sometimes because of the animating colision polygones. Wich is a bad thing.
Animating colision polygones in big steps can NOT handle Collisions, Solids, nor Physics.

Use One conddition. the condiditon 'is overlapping at ofset' for this situation. Replacing the 'on condition' and the 'is falling'.
B
33
S
18
G
28
Posts: 2,462
Reputation: 20,888

Post » Tue May 17, 2016 7:52 pm

@rkruis did you try my methods yet?
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Tue May 17, 2016 8:04 pm

PixelPower wrote:@rkruis did you try my methods yet?

Aww, OK. I understand how the collisions are working with animations. If I slow the animation speed down to 5 from 10, it works 90% of the time.

Yes, this is flawed and to fix it I have no real solution, but there are ways to adjust it to make it less prone to error.
1. Add more frames.
2. slow the animation speed.
3. use a solid object at the bottom, not a good solution for how the game works.
4. Use your suggestion, where I do not use Is falling, which i will check this out later tonight and let you know how it goes.
B
8
S
2
Posts: 14
Reputation: 506

Post » Tue May 17, 2016 8:12 pm

Pixel's option is a good 'general' solution too. But first you gots to learn eh ? : )

See it like this. I am supposed to tip you gentle on the nose. But, on the moment that i tip, i animate my finger with out moving my hand. In no time, i make my finger 3 times longer. Where is my finger then? This kind of animations cant be handled in a physics world. Platform is a physics world.
B
33
S
18
G
28
Posts: 2,462
Reputation: 20,888

Post » Tue May 17, 2016 9:23 pm

Yea, I completely understand the issue. :)

15 years as a developer but only 2 weeks on construct. It is a bit different than writing the code yourself.

Thanks for all of the help.
B
8
S
2
Posts: 14
Reputation: 506

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 7 guests