Push/pull - object gets stuck at random

Just started using Construct 2? Post your questions here

Post » Thu Aug 18, 2016 12:46 pm

Message: Xenodamage can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
I have used this tutorial for push/pull in a C2 platformer:
https://www.youtube.com/watch?v=gUgmBrPxWNE (loud music warning)

It works really well, but there is an issue that I have that occurs at random. After a while, I am unable to move the object from one of the sides, unless I do something random like wall jump and then try again. It makes no sense because it doesn't seem to have a clear trigger to me. Anyone know what's going on and how to fix it?

Here you can see it happening: https://youtu.be/fgkL-y9SyNw?t=17
B
4
Posts: 4
Reputation: 208

Post » Thu Aug 18, 2016 5:48 pm

You will have to post your capx, the tutorial seems rock solid to me.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Aug 18, 2016 6:48 pm

Message: Xenodamage can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Alright, here it is:
http://www.dropbox.com
/s/tcn0kghkj6qflrp/grody-pushpull.capx?dl=0

(had to split up the link because it wouldn't let me otherwise, sorry for inconvenience)

Note that this is my learning file, so there is a bunch of crap in the event, lol.

Hopefully you can make sense of it.
B
4
Posts: 4
Reputation: 208

Post » Thu Aug 18, 2016 9:48 pm

You have that 'player.y > Tombstone.y' (player compare y) in both the PUSH and PULL group. (in the top condition)

Well. See. The size of the player = 32*32. The tombstone = 32*32. Both origins are in the middle. Conclusion : Their Y should be the same (in a perfect world) when you push/pull because they stand on the same platform.

This condition should never be true, and therefor the whole event should never be true.

But. Positions in C2 go far in the decimals (like 45.458878884). Especialy when there are physics involved. Platform is a form of physics. Meaning: none of both objects is ever exactly 16 pixels above the platform. It is always near 16 pixels. Like platform y position + 16.01178 or platform y position + 15.8988.

Conclusion: sometimes the players.y is heigher then the Tombstone.y, sometimes it is lower. Why it sometimes works and sometimes not. When you make the player jump, the player gets a new Y when landing. And again, sometimes his Y is lower, sometimes his Y is higher then then the Tombstone.y.

Solution: offset the overlapper's orgin a few pixels towards the bottom. Now it should not collide on the bottom. And lose that condition 'player.y > Tombstone.y'.
Not sure if you need it at all.

You still have a few animation problems too. Hope you read trough the lines of my bad english.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Aug 19, 2016 5:58 am

Thank you so much, I think I understand and will give this a try later to see if I can get it to work!

Yeah the animation problems I will look into after this :)
B
4
Posts: 4
Reputation: 208

Post » Fri Aug 19, 2016 8:32 am

Tested it, and it seems to be working well. Haven't ran into the issue!

Now onto the animation issues,... any idea what to do? Haha. Time to head to Google ;) Thanks again for your help!
B
4
Posts: 4
Reputation: 208


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests