How To Make A Script That Sends Signal When You Get To X Points?

Discussion in 'Buildbox 3.0' started by Reverse Studios, Dec 18, 2018.

  1. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
  2. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    Hi,
    You can go to character => Advanced => Global Counter, you can adjust what triggers the global counter and after the set count is reached it will throw an action you desire.
     
    volcank and Reverse Studios like this.
  3. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Did not work when we tried it
     
  4. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Where do we find advanced do you mean nodes
     
  5. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    Please check the attachment, you need to add the script according to what you need the action to be. I believe it will work like that.
     

    Attached Files:

    Reverse Studios likes this.
  6. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Thanks so much just to confirm it is counting points
     
  7. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    In the default setting it will count lives
     
  8. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Any idea how to make it count points?
     
  9. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    Why do you need it to count point? there's already a point counter
     
    Reverse Studios likes this.
  10. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    In order to change character color when you are at 20pts
     
  11. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    You can set a counter to increase depending on how you are setting the rewarding points, and after that you set a color change.
    You can set as much colors as possible and make it be triggered depending on the counter value.
     
  12. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    How do we do that we are collecting points for score
     
  13. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    Ok, well I've been working on the issue for a while, unfortunately I couldn't get to change the color as we can't until now add a color attribute and connect it with an if - else statement.
    I was able to add a counter for distance and points upon the character movments, jump or what ever you want it to do.

    Step 1: will note the distance traveled by the character
    Step 2: will add score to the game

    Note: in my case I linked the distance to the score, you can just replace (Math.round(dit/60)) with any value you like.
     

    Attached Files:

  14. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Ok thanks a lot and to make it do points collected do we change distance string to something like point and when it gets to that amount it will send signal
    ok and to change to points we change the string from distance and it should execute signal?
     
  15. bgwiss

    bgwiss Boxer

    Joined:
    Oct 31, 2018
    Messages:
    58
    Likes Received:
    19
    In my game, I have linked the signal of my counter to the platform on which the character collides with. Every collision will make the script check distance and the position of the character. If the position of the character changes the points if statement will be enabled and will calculate the value.
    if you want just to include points without distance you can write something like that:

    if(value){

    let pos = this.entity().position();

    _rounded = Math.round(pos.y);

    if(_rounded < -5 && _rounded != _covered ) {

    _covered = _rounded

    this.scene().addScorePoint(10);

    _distance = _rounded;

    }

    This will add 10 points everytime the position changes.
     
  16. Reverse Studios

    Reverse Studios Boxer

    Joined:
    Oct 11, 2018
    Messages:
    74
    Likes Received:
    17
    Thanks a lot for your help you have done more than enough but if you can can you send us a bBDOC our email is playpixelstudios@gmail.com
     
  17. Vijay Deshwal

    Vijay Deshwal Boxer

    Joined:
    Feb 27, 2020
    Messages:
    3
    Likes Received:
    0

Share This Page