How do I change my climb state

  • 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

  • I'm gonna do a shameless bump on this.

    Sorry

  • meh, sorry, last time I bump this

  • 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.

  • 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?

  • Nevermind, I found the solution. But thanks for your help! you rock!

    cheers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • My solution was just an idea to better use "overlaps at offset". You'll probably get the same amount of collisions with either method.

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)