How Can I Make My Character Die In Certain Conditions

Discussion in 'How Can I...?' started by Meko, Feb 23, 2020.

  1. Meko

    Meko Boxer

    Joined:
    Feb 22, 2020
    Messages:
    4
    Likes Received:
    0
    Hello,

    So to offer some insight, I am creating a game where my character spends most of its time jumping/in the air.
    • I want to make my character die if in the proximity of the platform (the ground) for about 5 second.
    • Alternatively, another solution would be dying if the character has not collected any point in the last 3 seconds.

    For points, I am using invisible rectangles (15/scene). I have tried setting a Defeat condition with an If Collide with the rectangle on a 3-second Delay with a Reset on new collisions, but it didn't seem to work -> The character never dies, even after he stops getting points.

    I have also tried setting an If Collide with the Platform into Defeat after 3 seconds Delay, with a reset condition on the If Collide with the Point Rectangle. But the reset never occurs, the character dies after the 3 seconds from touching the ground.

    I have also tried doing multiple combinations with the above ideas, but didn't manage to reach a happy conclusion.

    With these said, I'd really appreciate some help. I have tried browsing both the forums and youtube, and I didn't find anything related to what I need.

    Thanks in advance!
     
  2. Meko

    Meko Boxer

    Joined:
    Feb 22, 2020
    Messages:
    4
    Likes Received:
    0
    Edited what I want for it to be more clear.
    • I want to make my character die if in the proximity of the platform (the ground) for about 5 second. If the character leaves the proximity of the platform, the timer should stop. It should start again from the scratch(5 seconds) the next time it enters the collision box of the ground. So on until the character finally died for being in the proximity of the platform for 5 whole seconds.
    • Alternatively, another solution would be dying if the character has not collected any point in the last 3 seconds.
    I feel like the second solution would be better and seemingly easier, but I just can't get it to work, no matter how much I struggle.
     
  3. Meko

    Meko Boxer

    Joined:
    Feb 22, 2020
    Messages:
    4
    Likes Received:
    0
    Well, since nobody seems to have a clue, I guess I'll move to Unity and learn my way there with the help of assets.. too bad I have to do the game from scratch, since it was almost done, but at least I have all the options put at my disposal there
     
  4. Hue Buildbox

    Hue Buildbox Administrator Staff Member

    Joined:
    May 11, 2017
    Messages:
    385
    Likes Received:
    169
    This is possible & perhaps w/o any custom code. Have you posted this question on Discord? I would try the Buildbox Discord #javaScript channel. Lots of guys there that would love to take on this challenge.
     
  5. Hanomax

    Hanomax Avid Boxer

    Joined:
    Aug 24, 2018
    Messages:
    156
    Likes Received:
    85
    Solution for dying if any points hasn't collected for 3 seconds:
    In character's node map, add Timer Node. Time value is 3. Connect enabled input with start node.
    Add if Collide node, affected asset is point. Input connect with start node and output with Timer's reset input.
    Timer node output connect with defeat node, which is connected with event node's game over input.
    And check collision shapes. Point asset's physics must be enabled, so it can collide with it. And it must collide with character's collider, which is affected by points, before it is disappearing.
    Or you could use Send node inside points node and Receive node inside character's node map, to reset timer. In that case, Point asset physics is not necessary.
    And yes, asking in Discord server is much better.
     
    Hue Buildbox likes this.
  6. Smart Penguins

    Smart Penguins Boxer

    Joined:
    Jan 2, 2020
    Messages:
    62
    Likes Received:
    69
    Here is a Timer tutorial that we made a month ago. Hope this helps.

     
  7. Meko

    Meko Boxer

    Joined:
    Feb 22, 2020
    Messages:
    4
    Likes Received:
    0
    Hey guys,

    Thanks a lot for the answers. I didn't know about the discord. Will re-open my project on buildbox and try your solutions. I'll come to discord if anything else arises. Thanks again ^^
     

Share This Page