Help With Pick Up Bullets

Discussion in 'Buildbox 3.0' started by Ionuts13, Aug 23, 2019.

  1. Ionuts13

    Ionuts13 Boxer

    Joined:
    Jul 16, 2019
    Messages:
    7
    Likes Received:
    0
    Hello, boxers! I have a problem with pick up bullets. You can see below what is about.

    What is the fix for this?
    In the first example, i can pick up bullets but the item doesn't disappear.
    In the second part of the video, the item disappears but the number of bullets is the same.
    What is the fix for this?
     
  2. Josh (Nology Games)

    Josh (Nology Games) Avid Boxer

    Joined:
    Nov 27, 2017
    Messages:
    200
    Likes Received:
    155
    hello, can you show a screenshot of your script? it seems like that would be the issue
     
  3. Ionuts13

    Ionuts13 Boxer

    Joined:
    Jul 16, 2019
    Messages:
    7
    Likes Received:
    0
    var _Enabled = false;

    var _Release = false;

    var counter = 0;

    var countermax;

    var spawndelay

    var bullet





    function init(){



    bullet = this.attribute('Bullets');

    spawndelay = this.attribute('spawndelay');

    Usebullet = this.attribute('Usebullet');

    givebullets = this.attribute('givebullets');



    }







    function start(){





    let labels = this.ui().find('Label');

    _label1 = labels[0];







    }





    function update(dt){



    if(_Enabled){

    if(_Release == false){

    if(Usebullet == true){

    if(bullet >=1){





    let coins2 = this.scene().find('Actor');

    let coins3 = this.scene().find('Bullet Position');



    for(var i=0; i < coins2.length ; i++){



    let coin2 = coins2;

    let coinPos2 = coin2.rotation();



    let coin3 = coins3;

    let coinPos3 = coin3.worldPosition();









    counter += 1;







    if (counter >= spawndelay) {

    bullet -= 1

    //log(bullet)



    _label1.setText(String(bullet))





    let assetName1 = this.attribute('Asset Name1');

    let ent1 = this.scene().create(assetName1);



    let posbullet = this.entity().worldPosition()







    ent1.setPosition(coinPos3.x, coinPos3.y, coinPos3.z);

    ent1.setRotation(0, coinPos2.y, coinPos2.z);



    ent1.setScale( 0.4, 0.4, 0.4);

    //log(coinPos);



    counter = 0;

    }



    }



    }

    }



    else if(Usebullet == false){





    let coins2 = this.scene().find('Actor');

    let coins3 = this.scene().find('Bullet Position');



    for(var i=0; i < coins2.length ; i++){



    let coin2 = coins2;



    let coinPos2 = coin2.rotation();

    //log(coinPos2)



    let coin3 = coins3;

    let coinPos3 = coin3.worldPosition();





    counter += 1;







    if (counter >= spawndelay) {









    let assetName1 = this.attribute('Asset Name1');

    let ent1 = this.scene().create(assetName1);



    //log(this.entity().parent().rotation());



    ent1.setPosition(coinPos3.x, coinPos3.y, coinPos3.z);

    ent1.setRotation(0, coinPos2.y, coinPos2.z);



    ent1.setScale( 0.4, 0.4, 0.4);

    //log(coinPos);



    counter = 0;

    }



    }





















    }



    }



    }





    }









    function signal( name, value){

    if(name == 'Enabled'){



    _Enabled = true;

    _Release = false;

    //log(_Enabled)

    }



    if(name == 'Release' && value){

    _Release = value;

    //log(_Release)

    _Enabled = false;

    //log(_Enabled)





    }



    if(name == 'bullet' && value){



    if(Usebullet == true){

    bullet += givebullets

    _label1.setText(String(bullet))



    }

    }







    }
     
  4. Ionuts13

    Ionuts13 Boxer

    Joined:
    Jul 16, 2019
    Messages:
    7
    Likes Received:
    0
    Can you help me ? Above you have the code.
     
    Last edited: Sep 3, 2019
  5. Ionuts13

    Ionuts13 Boxer

    Joined:
    Jul 16, 2019
    Messages:
    7
    Likes Received:
    0

Share This Page