Apply Random Or List Color Node

Discussion in 'BBNodes' started by particles, Oct 30, 2018.

  1. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    Price(FREE or PAID): FREE
    Node Name: SKRandomColors SKArrayColors
    Type of Node: look
    Description: Applying random colours or array colours to the object.
    Special Instructions: Ability to change colour.
    Author: @particles
    Date Uploaded: 10-30-2018
    Last Update: 10-30-2018

    [​IMG]


    Apply List of Colors

    [​IMG]
     

    Attached Files:

    Last edited: Oct 30, 2018
  2. Phil H

    Phil H Boxer

    Joined:
    Jul 21, 2018
    Messages:
    10
    Likes Received:
    3
    Thank you for the file.
     
    particles likes this.
  3. wesam_badr

    wesam_badr Miniboss Boxer

    Joined:
    Oct 10, 2015
    Messages:
    1,064
    Likes Received:
    479
    thank for this I managed to make it work before but how can we make the color change by time or by distance if you can provide that that would be a life-changing. thank you.
     
  4. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @wesam_badr Attached Random Colors by an interval, it's quite simple. Hope this will helps you.

    [​IMG]
     

    Attached Files:

    spicedbeangames and wesam_badr like this.
  5. wesam_badr

    wesam_badr Miniboss Boxer

    Joined:
    Oct 10, 2015
    Messages:
    1,064
    Likes Received:
    479
    Thank you i hope it work
     
  6. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    @particles Thanks for the node and all the other nodes I've found in the forum. Are your nodes available anywhere without stumbling across them in forum articles?
     
  7. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @PunkPuffin I haven’t placed everything in one common place to share. I will try to do that.
     
  8. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    That would be great
     
  9. lazerDev

    lazerDev Boxer

    Joined:
    Dec 24, 2018
    Messages:
    12
    Likes Received:
    1
    Can you code a node with color detection? Where if thetcharacter collides with an object the same color as itself one thing happens and if it collides with an object of a different color another thing happens?

    Like in color switch
     
  10. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @lazerDev Compare the colour values of both by
    let c1 = character.color();
    let c2 = enemy.color();
    if(c1.r == c2.r && c1.g == c2.g && c1.b == c2.b){
    // Color Match
    }else{
    // Color doesnt Match
    }
     
  11. lazerDev

    lazerDev Boxer

    Joined:
    Dec 24, 2018
    Messages:
    12
    Likes Received:
    1
    thank you so much!
    unfotanately i am not experienced in coding and i dont understand how to use the code you wrote :)
    maybe you can create a node where i can connect to 1 node (defeat) if color doesnt match and to another (score +1) if it does match?
     
  12. itzonator

    itzonator Serious Boxer

    Joined:
    Dec 18, 2017
    Messages:
    589
    Likes Received:
    228
    @particles -> thanks for sharing.

    Do you have an idea of how to create random color change of certain elements (objects) on a scene after few games played. Like for example to change the color of Ground if game is played 3 times? This is tied to event observer maybe, I am not sure. Can you reproduce such result? This will randomize the colors within the game to avoid boredom and increase retention ;-)
     
  13. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @itzonator You can store a value say PlayCount in Settings and increase by 1 in every play. Once it is crossed 3, you can apply random colors to Ground

    if(Settings.PlayCount == undefined){
    Settings.PlayCount = 0;
    }
    Settings.PlayCount += 1;

    if(Settings.PlayCount % 3)
    {
    // Apply New Color
    }else{
    //Keep Old Color
    }
     
    itzonator likes this.
  14. Jacob Bennett

    Jacob Bennett Boxer

    Joined:
    Mar 14, 2019
    Messages:
    1
    Likes Received:
    0
    Hey, I love this so far. I saw the code you had previously when someone asked if character collided with an object x event would happen. "let c1 = character.color();
    let c2 = enemy.color();
    if(c1.r == c2.r && c1.g == c2.g && c1.b == c2.b){
    // Color Match
    }else{
    // Color doesnt Match
    }"

    I know the code and I understand how it works. but what would you put in the if statement? Ex; if the color does not match then color.kill? I mean how does that work in buildbox with the code? How could I say if the color matches then +1 score or if the color does not match then the user will die. I guess i'm confused, i'm used to just dragging nodes around and have no idea what to put inside the if statement to make an event happen like example above.

    How would that work? Love the nodes so far, thank you so much if you've read this far.
    Seriously thank you.

    Cheers.
     
  15. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    @Jacob Bennett
    You can add your next action in the if else statement.

    if(c1.r == c2.r && c1.g == c2.g && c1.b == c2.b){
    // Color Match
    this.scene().addScorePoints(1); // You can add points
    this.emitSignal('ColorMatch',true);// connect this to an output node to do next step.
    }else{
    // Color doesnt Match
    this.emitSignal('KillMe', true);//Connect an output node to gameover or whatever you want.
    }"
     
    Jacob Bennett likes this.

Share This Page