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?
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)) } } }