Platform Behaviour unreliable

Discussion and feedback on Construct 2

Post » Sun Jan 05, 2014 7:26 pm

Hello folks,
having some issues with the Platform behaviour being unreliable for jumping.

sometimes it takes 2 or 3 key/controller presses before it gets called.

my variable is definitely being set/unset properly (checked in debug) but often the "Simulate Platform pressing Jump" just doesn't work, everything else will get called in the function but the character wont jump.
This seems to be fairly random and I cant track down a pattern in it.
Tried to counter this by manually setting the X/Y values just before the jump in case it was a collision issue but that's not helped either.




any ideas?MattTonkinson2014-01-05 19:27:40
B
9
S
2
Posts: 69
Reputation: 833

Post » Sun Jan 05, 2014 7:35 pm

The platform behaviour works best using a rectangular collision polygon (or at least, a collision polygon with the bottom side horizontal), does your sprite meet this requirement?
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Jan 05, 2014 7:37 pm

Yup, that was the first thing I checked.

B
9
S
2
Posts: 69
Reputation: 833

Post » Sun Jan 05, 2014 7:40 pm

The jump action only performs if the object that has the platform behavior is in collision with a solid/jumpthru object.

It would be easier if you posted directly your capx instead of screenshots.

You can check for the condition "is on floor", if it is true, then the jumping reacts accordingly.

Check out this game does the jumping (up arrow) works as you would expect ?
It's only the platform behavior with correct collision box.Kyatric2014-01-05 19:41:28
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,295
Reputation: 70,795

Post » Sun Jan 05, 2014 7:42 pm

@MattTonkinson:

I meant on all the animations where the character could potentially jump (aka when it is on the ground)

(Also, there are condition to check if the character is on the ground or not, maybe you could use that instead of the IsJumping variable, just a thought, maybe you need the IsJumping for something else)

EDIT: samourai'd, I mean ninja'd by kyatricAphrodite2014-01-05 19:43:07
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Jan 05, 2014 7:45 pm

Might not help but I note you have a delay of 0.1s before setting the is jumping variable to 1. Try putting the is jumping zero check as a first condition and then the keyboard / game controller checks as sub events and also change the is jumping to 1 to before the wait. Hope this makes sense - UK on my phone.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Sun Jan 05, 2014 8:13 pm

Hello guys, cheers for the replies and suggestions, appreciate it!

Tried using the "is on floor" behaviour and still getting same result.
Also removed the manual "isjumping" check in favour of "is on floor".

Pasted some objects etc into a sample file to reproduce the results with a simple event tree.
(includes character sprite with the anims to show collision is standard rectangle on all frames)


Skydrive link to CapX:

https://skydrive.live.com/redir?resid=7729782E0D1EF1EF!192&authkey=!ANckyICODxEnSCM&ithint=file%2c.capx
B
9
S
2
Posts: 69
Reputation: 833

Post » Sun Jan 05, 2014 9:19 pm

This might help:

Each animation frame has the collision set to bounding box but each frame is a different width and the origins are at different y distances from the bottom of the collision box. So, when the animation runs, each new frame puts the collision box either overlapping the ground or above the ground by a few pixels - this will be exacerbated on the slope when the effect of frames of different widths also comes into play.

With your 'is on platform' check I don't see any 'should be jumping' notifications when the character actually doesn't jump, but I do see that some jump key presses can be missed.

The fix - create an invisible rectangle about the average frame size of the runner and give that the platform behavior you want. Pin the runner sprite to it and voila!
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Sun Jan 05, 2014 9:50 pm

Hi @MattTonkinson

I second the opinion that your "Wait" action is the most likely source of problems. Be aware, that your script does not stop while "Wait" is executed - it simply skips the remaining part of sub-event, but all other remaining events do run without waiting!

"Wait" might cause really non-intuitive behaviour with variable assignments, especially when used with local variables.

Try removing "wait" to see if your app behaves OK without it.

G.
B
18
S
3
G
3
Posts: 83
Reputation: 3,736

Post » Mon Jan 06, 2014 2:37 am

Thanks for all the suggestions folks!

The final solution was actually thanks to @Colludium - their idea of the invisible uniform box being used as a "fake player" with the actual sprite just pinned to it has worked a treat. No more problems with jumping!

Excellent idea mate, thankyou!
B
9
S
2
Posts: 69
Reputation: 833

Next

Return to Construct 2 General

Who is online

Users browsing this forum: SirG and 18 guests