Use 8Direction behavior to walk backwards

  • In using the 8Direction behavior, I want to add a feature where the character will walk backwards by holding down an additional key (ie: shift).

    I've tried several different iterations with only one moderate working example.

    Right now, I have it set up as follows:

    • KEYBOARD: Shift is down

    -- Sprite: Set mirrored

    That, obviously, reverses the image while the directional controls remain the same.

    If I added the use of Sprite: 8Direction Reverse, it acts as if it can't make up its mind on whether to keep moving ahead or to change directions.

    Basically, I'm trying to get it to where holding right will cause the character to move left, etc. while the shift key is down.

    Alternatively, I could set it where I use Simulate Controls, but I'd like to see if there's something I'm overlooking and if there's an easier way.

  • try this:

    <img src="http://666kb.com/i/cjsjftf6eg27rp401.png" border="0" />

    1.3 means it runs at 30% of normal max speed, 2 would mean it runs at the same speed as going forward.

    Edit: you probably need to use custom controls and swap them when holding shift for it to work like you want.

    ofc what you also can do is:

    default controls off

    simulate controls

    key "up" is down:

    • shift is down: simulate down
    • else: simulate up

    for each direction

    and

    on shift pressed: set mirrored, maybe lower the speed

    on shift released: set not mirrored, restore to former speed

  • Yeah, I think that's what I'll do. If only to ensure that I know what I'm plugging into my game. What you have there kinda makes sense, but I guess the Custom Controls would be a better bet.

    Thank you for your input and help, though! :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah I think simulating the controls directly is the more direct way, else you could run into some unwanted collisions maybe.

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