Player Death Glitching [SOLVED]

Just started using Construct 2? Post your questions here

Post » Mon Aug 15, 2016 8:58 am

Hi, all.

Not sure what I'm doing wrong.

Doing a first player death sequence on collision with sprite and it works fine for the most part, but occasionally glitches twice.

--
player-on collision with - set to player death animation

wait 1.0 seconds

player - set animation default
player - set position x y

--

I tried it also with destroying the player and then system create object again, but it does glitch again when it falls occasionally.

The player spawn sequence is the default from the Scirra template (if player is outside layout, move player to position x).

The glitching is the player occasionally falling twice.

Anybody saw this, solved it?

Why does it happen?

What's the proper coding sequence?
--
I added the collisions enabled as second flag as recommended by a you tube video (seems better), but still glitches occasionally (falls twice).

--
there is the destroy player - restart layout alternative (only foolproof one?) but I wanted to do it without spawning the layout again (or saving the previous one).

--
putting everything in a function but but the switching of animation seems to make it glitch the least (like 1 out of 20 tries), but if anyone has a foolproof solution, would very much appreciate it.

and it seems to happen mostly when holding a key - like simulate platform pressing left etc.

--
could it be because the player is colliding with an animated object - 2 frames? and the collision condition only specifies the 1st frame? don't think so.
Last edited by AmpedRobot on Sun Aug 21, 2016 4:39 am, edited 3 times in total.
B
37
S
20
G
18
Posts: 259
Reputation: 12,922

Post » Tue Aug 16, 2016 5:34 am

Here is the capx.

http://www.darksunpictures.com/public/DEATH_GLITCH.capx

Basically to replicate the glitch, keep pressing the right and up arrows at the same time while aiming at the flashing object.

Very shortly, you should begin respawning twice intermittently while in the air.

Can anybody confirm the error?

Found a fix?

----

This seems solved by RojoHound's portal spawner thingamjiger at another object with associated goodies.

I've only had it glitch once, but I haven't been able to replicate the glitch since despite my best efforts.

---

I really don't understand it. Now, it's glitching all the time UNLESS u hold both arrow keys, so if you allow the player sprite to fall after collission it almost always falls twice, which is what I don't want as it looks like an obvious glitch.
B
37
S
20
G
18
Posts: 259
Reputation: 12,922

Post » Tue Aug 16, 2016 6:47 am

Here's the RojoHound version.

This one glitches when you release the up and right arrow keys right after collision.

The player usually falls twice from respawn point.


http://www.darksunpictures.com/public/r ... h_new.capx

---
Ideally, I would also like to block movement until player falls to ground and have the angle fixed while falling downward, but I dare not even attempt this until the above is solved.
B
37
S
20
G
18
Posts: 259
Reputation: 12,922

Post » Wed Aug 17, 2016 5:07 am

Uhm, did I become some sort of a Construct 2 social pariah after my monetisation post?

I just didn't see the built in objects. They were new to me.

Before people were helping.

Now, no one is helping.

This is very disappointing.

If this bugginess is a normal part of Construct 2, I really wish I hadn't bought my license as it seems to glitch on the simplest things.
B
37
S
20
G
18
Posts: 259
Reputation: 12,922

Post » Wed Aug 17, 2016 8:43 am

I think that wait is the cause of the glitch. I would do it like this:

Image

isDead is a boolean instance variable.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Wed Aug 17, 2016 8:46 pm

Yes it's because of the wait. You are not destroying the player object when it dies, rather repositioning it so the player can move the sprite whilst the wait is going on. Put the wait outside of the function or don't use a wait at all as in the above example.
B
46
S
16
G
78
Posts: 2,168
Reputation: 46,353

Post » Sun Aug 21, 2016 4:41 am

Thank you, Asmodean.

That code rules.

And thank you for the introduction on instance variables.

I'll be sure to credit you.

Plinkie, thanks for the input. I did experiment with toggling wait before, but it produced weird results.

I stopped at Asmodean's code because it really works and is unbreakable.

A little thing like that would've made the game look really unprofessional.
B
37
S
20
G
18
Posts: 259
Reputation: 12,922


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest