custom 8 way behavior problem

0 favourites
  • 5 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hi guys, I think I am making a logical error...

    this is a simple 8way custom behavior.

    It seems to have a preference of direction...example...

    if I move left, and press right ( still holting down left) it goes RIGHT.

    But of I make the oposite... moving right and pressing left ..it continues right... I tried subevents... but without success... I need this:

    if right is pressed and then press left...move left...if left pressed and than press right..move right...

    here is the fabook link for the capx... please help me guys...

    thanks so much

    https://lookaside.fbsbx.com/file/TEST%2 ... mJsYREqu5D

  • The bottom event overrules the movement because construct works from top down. The problem with sub events is that all the events will still be true because both keys are down so again it will do the same thing and pick the bottom event. You could try toggling a specific variable on when D is down and a different variable when A is down which should block out each of the events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks, any other who had the same problem ?

    I treid a lot... with no result...

    thanks

  • Hey mariogamer,

    this should work:

    + Keyboard: D is down
    + PLAYERFIGHTERa: left_right ≥ 0
    -> PLAYERFIGHTERa: Set CustomMovement Horizontal speed to 400
    
    + Keyboard: D is down
    + System: Trigger once
    -> PLAYERFIGHTERa: Set left_right to 1
    
    + Keyboard: A is down
    + PLAYERFIGHTERa: left_right ≤ 0
    -> PLAYERFIGHTERa: Set CustomMovement Horizontal speed to -400
    
    + Keyboard: A is down
    + System: Trigger once
    -> PLAYERFIGHTERa: Set left_right to -1
    
    + Keyboard: W is down
    + PLAYERFIGHTERa: up_down ≤ 0
    -> PLAYERFIGHTERa: Set CustomMovement Vertical speed to -400
    
    + Keyboard: W is down
    + System: Trigger once
    -> PLAYERFIGHTERa: Set up_down to -1
    
    + Keyboard: S is down
    + PLAYERFIGHTERa: up_down ≥ 0
    -> PLAYERFIGHTERa: Set CustomMovement Vertical speed to 400
    
    + Keyboard: S is down
    + System: Trigger once
    -> PLAYERFIGHTERa: Set up_down to 1
    
    + Keyboard: On D released
    -> PLAYERFIGHTERa: Set CustomMovement Horizontal speed to 0
    -> PLAYERFIGHTERa: Set left_right to 0
    
    + Keyboard: On A released
    -> PLAYERFIGHTERa: Set CustomMovement Horizontal speed to 0
    -> PLAYERFIGHTERa: Set left_right to 0
    
    + Keyboard: On W released
    -> PLAYERFIGHTERa: Set CustomMovement Vertical speed to 0
    -> PLAYERFIGHTERa: Set up_down to 0
    
    + Keyboard: On S released
    -> PLAYERFIGHTERa: Set CustomMovement Vertical speed to 0
    -> PLAYERFIGHTERa: Set up_down to 0
    [/code:2a0h1fhg]
    
    .c3p-file: https://1drv.ms/u/s!Ap_-qxoGKbDcblqe_8E7oYDLpLI
  • thank U so much 4 your help

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