Player falling through platform glitch....

Just started using Construct 2? Post your questions here

Post » Mon Aug 25, 2014 5:32 pm

tomhaiger wrote:When the player runs or falls off the platform, they shouldn't move left or right, the X position should stay fixed so that doesn't happen.

In my game, when you fall off, my player moves to the left of the screen, which it shouldn't do. It should stay in the same X position.

I tried to fix this by creating an event that sets my player's X manually when falling, and although this worked, my player starts going through platforms which is the glitch I'm refering to in the 1st capx.

I don't even understand..... hmmm if the player is not supposed to go to the left upon falling, you mean the platform should stop moving? You have to choose either a) or b):

a) player move left upon falling, platform keep moving
b) player stay at current x, platform stop moving

assuming you choose b), look at my capx, hope it gives you something. Btw, line 12 is wrong, i've corrected it, didn't check everything in detail, line 12 just too obvious.
Line 16 is to do b)
Line 17 is just added to see whether you want things to proceed running if it is not falling.

Autorunner Example line16.capx


PS: option c) player stay at current x AND platform keep moving AND no glitch >>>>>> IMPOSSIBBBRUUUU!! :o :o
You do not have the required permissions to view the files attached to this post.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Tue Aug 26, 2014 1:06 pm

Right...... OK, obviously i've not made my issue clear enough to understand what i'm on about so lets try some visual aids, maybe that help explain what i'm refering to.

Image
This is what i'm talking about. This is from my 2nd capx. Do you notice how each time the player drops, the player moves closer and closer to the left? The player ends up at the edge of the screen... This is what i want to FIX.

Image
Note the difference with this example, where the player drops but does NOT move to the left and end up at the edge of the screen? This IS how i want it.

(Apologies for the quality, should be OK though)

I tried fixing this issue on the 1st capx i posted by setting the player's X (which is line 16 in the capx), but ended up with a glitch where the player moves through platforms. Judging by the feedback,I'm guessing this is the wrong way to go about it, so i'm looking for a solution to the problem above, where the player moves to the left when falling.

I hope thats made it clear and any help would be appriciated.

Btw, line 12 is wrong, i've corrected it, didn't check everything in detail, line 12 just too obvious.

This is from the Autorunner Template on Construct 2.
B
5
S
2
Posts: 126
Reputation: 876

Post » Tue Aug 26, 2014 3:43 pm

tomhaiger wrote:
Btw, line 12 is wrong, i've corrected it, didn't check everything in detail, line 12 just too obvious.

This is from the Autorunner Template on Construct 2.

Oh yeah! I stand corrected, It's different from my approach because I tend to Pick whatever I want to destroy. Learnt something today :D thanks.

Back to topic:
Aha! from your first video/gif it seems to behave like that in your pc, in mine it does not, weird. I dont think it's a bug, most probably it's your machine performance? Mind if you specify your machine spec, OS, browser you tested. I tested in all browser and all seems fine.

Can you get your hand to other pc probably? Best thing I could suggest to help is try to export it, and run index.html. See whether it persist.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Tue Aug 26, 2014 4:15 pm

Windows 7 Ultimate 64 bit
i7 860 @ 2.80GHZ
8GB DDR3 RAM

I tested it on Google Chrome


I doubt its my PC performance and also the same thing happens when i test it on CocoonJS Launcher.

Just to make sure, the first gif is from the 2nd capx i posted. Both capx i posted have the same name i think (sorry) so it could be a little confusing if you downloaded both. I quite odd that i have this issue but you haven't.

I've uploaded the capx again, so please try this and see.
You do not have the required permissions to view the files attached to this post.
B
5
S
2
Posts: 126
Reputation: 876

Post » Tue Aug 26, 2014 5:03 pm

Ah I tried tweak something in the official runner example, finally able to recreate it. It seems Line 9 (yours is Line 14) had to be modified to suit the speed. I can see the "hiccup to the left" when I change the speed from 300 to 1000, can see it quite obvious.
Most probably this has something to do with dt multiplier.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Tue Aug 26, 2014 6:12 pm

At least we can agree that the issue is there.

I've tried modifying that line but no luck but i'm still a beginner so thats not saying much :) Do you have any suggestions on how to fix this?
B
5
S
2
Posts: 126
Reputation: 876

Post » Tue Aug 26, 2014 6:26 pm

on your line 14, try:
Set X to Self.X+Player.Platform.MaxSpeed/fps*dt

Let us know what happen.

Suggestion for line3:
click Line3 then press B button, then put in:
Code: Select all
Condition: Player X not equal 105
Action: Set Player.X to lerp(player.x,105,0.5)

This will restore player to x=105 while on floor.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Wed Aug 27, 2014 5:46 pm

on your line 14, try:
Set X to Self.X+Player.Platform.MaxSpeed/fps*dt


This didn't work for me, nothing changed.

Suggestion for line3:
click Line3 then press B button, then put in:

Code: Select all
Condition: Player X not equal 105
Action: Set Player.X to lerp(player.x,105,0.5)


This will restore player to x=105 while on floor.


This does work, although the player still jitters when falling, but i guess i'll have to live with it :)


One issue though.... Remember in the 1st post where i mentioned the glitch about falling/running through the platforms? I get that problem when i test my game out on the phone via CocoonJS Launcher.

This issue doesn't happen that often on the PC, but i have seen it do it a couple of times on Chrome but when testing on CocoonJS Launcher, it happens often enough.

So now i have that problem to deal with, any help with this?
B
5
S
2
Posts: 126
Reputation: 876

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest