How do I change my climb state

Get help using Construct 2

Post » Fri Jan 22, 2016 6:28 pm

Ok, so I presently got a nice climb onto a ledge system. but it uses a extra detect sprite attached to the player sprite.
I realized that this causes the system to calculate extra detection of collisions, so I want to find a better and more optimal solution.

What I did was add an intance variable for when the player is mirrored or not which are either 1 or -1

Now, I tried doing this:
PlayerDetect is overlapping at offset ledge at PlayerDetect.X + (PlayerDetect.PlayerDirection*8)
(Then also added the detection of the point at Y)

But is not working. Only way so far I can make the climb system is by using an extra sprite. So is there any solution?

Thanks in advance
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Jan 23, 2016 1:19 pm

I'm gonna do a shameless bump on this.
Sorry
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sun Jan 24, 2016 7:04 pm

meh, sorry, last time I bump this :D
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sun Jan 24, 2016 11:53 pm

Maybe this?

PlayerDetect is overlapping at offset ledge at (PlayerDetect.PlayerDirection*8, 0)

The offset is relative to the player. It's the same as if the object is moved 8 pixels to the left or right before checking for the overlap.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Mon Jan 25, 2016 1:10 am

@R0J0hound, thanks that works amazingly good. This way I avoid using an extra sprite for detecting ledges.
But now I face a new issue:
Climbing is done in only one ledge and even if I try to grab another one I still get warped to the same point. Should I do a check up of the ledge being triggered using their UIDs?
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Mon Jan 25, 2016 1:22 am

Nevermind, I found the solution. But thanks for your help! you rock! :)
cheers
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Tue Jan 26, 2016 12:48 pm

Theres a problem that raises with R0J0hound solution. If I keep the button press while entering climbing state, once on top of the ledge Player goes back to hanging position. I suppose this is due to Y being zero.

Also, am I optimizing this for nothing or will I have some performance gain at the end?
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Tue Jan 26, 2016 5:57 pm

My solution was just an idea to better use "overlaps at offset". You'll probably get the same amount of collisions with either method.
B
94
S
33
G
118
Posts: 5,396
Reputation: 75,853

Post » Tue Jan 26, 2016 6:11 pm

Ah ok, well, that sucks. I thought that by getting ride of an extra collision detection sprite (so far I use 3 or 4 attached to the player sprite) I would have a reduction in the collision detections.

Thanks!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570


Return to How do I....?

Who is online

Users browsing this forum: Zzarkz and 18 guests