How Can I Prevent Exiting The Platform?

Discussion in 'How Can I...?' started by sueraali, May 18, 2020.

  1. sueraali

    sueraali Boxer

    Joined:
    Jan 8, 2016
    Messages:
    20
    Likes Received:
    4
    Hello to everyone.

    I have a character that progresses on the platform in my game. How can I prevent my character from going off the platform? Is there a node or Java Script code for it?
     
  2. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Use the event observer node and select the menu jump for end of level, or game over.
     
  3. sueraali

    sueraali Boxer

    Joined:
    Jan 8, 2016
    Messages:
    20
    Likes Received:
    4
    Thanks for the answer, but that's not what I'm looking for.

    My game has a gameplay like in the photo. I control my character with 4-way swipe. I want my character not to act outside of my platform. I want to prevent this when I want to leave the platform.
    Ekran Resmi 2020-05-19 01.37.00.png
     
    Last edited: May 18, 2020
  4. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    What I understood is that you want disable 4-Way swipe node when the character is outside of platform ? right ?
    if that what you want, you can add script with one variable, two input signal and two output signal connected to state machine ( 2 state one connected to 4-way swipe and second unconnected
    when touch the platform(first input) var = true and first output signal is true
    when outside of platform (second input) var = false and second output signal is true
     
    sueraali likes this.
  5. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    now i get it, after you edit your post,
    well,
    of course it's possible using code
    and there are a lot of ways can build this functions
    like....
    you can set 4 objects and put one of them at each corner
    one enable right, 2 left, 3 ahead, 4 back
    and 4-Way swipe node connected to script node with 8 inputs and 4 outputs
    first 4 inputs connected to 4-WaySwipes and others connected to if collide or receive node from 4 objects
    if collide object 1 right enable and all others disabled so if swipe right then.....
    if collide object 2 left enable and all others disabled so if swipe left then.....
    and so on....
    i think it's a simplest way to build this function....
    hope this is help
     
    sueraali likes this.
  6. sueraali

    sueraali Boxer

    Joined:
    Jan 8, 2016
    Messages:
    20
    Likes Received:
    4
    This is my node sort. but it does not prevent the character from going off the platform. Because I don't know how to introduce the off-platform area.
     

    Attached Files:

  7. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    ok
    i will build this script for you.
    give me 2 sec....
     
  8. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    aminee likes this.
  9. sueraali

    sueraali Boxer

    Joined:
    Jan 8, 2016
    Messages:
    20
    Likes Received:
    4
    thanks bro
     
  10. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    YW
     
  11. sueraali

    sueraali Boxer

    Joined:
    Jan 8, 2016
    Messages:
    20
    Likes Received:
    4
    Thank you for your effort, buddy. Works perfectly for fixed platforms. But I am looking for a solution for mobile platforms. For example, the platform does not work when you change direction with rotation animation.
     
  12. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    I only developed an idea for you, not an completed system, just a rudimentary system
    as i told you,
    understand this script and build what you want,
    the final result may be complicated...
     

Share This Page