Robot Game

Subscribe to Robot Game 12 posts

avatar for fons912 fons912 3 posts
Flag Post

i making a robot game….basically the robot need to recharge his battery before it runs out and i only noe how to do the timer bar but dont know how to make it recharge after it ate some battery..pls help

 
avatar for Draco18s Draco18s 6860 posts
Flag Post

So the “timer bar” has a current value…and a maximum value, yes?

When you “eat” a battery, add some value to the current value, making sure not to go over the maximum value.

Amazing!

 
avatar for stage_phrite stage_phrite 42 posts
Flag Post

do you want it to recharge over a period of say 30 seconds or just instantly recharge?

 
avatar for fons912 fons912 3 posts
Flag Post

i using this script
gameOver.visible = false; //to hide it first

bar.addEventListener(Event.ENTER_FRAME, waitTimer);

function waitTimer (e:Event){
if(bar.currentFrame == bar.totalFrames){
gameOver.visible = true;
bar.removeEventListener(Event.ENTER_FRAME, waitTimer);
}
}

how to write the script to add value? i jz wan limited recharge….let say the health drop from 50 to 20 and i only can recharge 10 life only

 
avatar for Draco18s Draco18s 6860 posts
Flag Post

Then your doing it wrong. This is how you make a health bar

But if you want to do it that way, then your batteries would do this:

bar.gotoAndPlay(bar.currentFrame - 10);
 
avatar for fons912 fons912 3 posts
Flag Post

then how to increase the value if eaten battery?

 
avatar for ErlendHL ErlendHL 1312 posts
Flag Post

._.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by fons912:

then how to increase the value if eaten battery?

Do you English?

Originally posted by Draco18s:

But if you want to do it that way, then your batteries would do this:

bar.gotoAndPlay(bar.currentFrame - 10);
 
avatar for GameBuilder15 GameBuilder15 8810 posts
Flag Post

I think he means something like

if(battery < 100){
rechargeBattery();
}

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by GameBuilder15:

I think he means something like

if(battery < 100){
rechargeBattery();
}

His battery is made of frames. the .currentFrame property is what he needs for all of that.

 
avatar for GameBuilder15 GameBuilder15 8810 posts
Flag Post

Oh, haha, I used to do stuff like that. It’s very glitchy.

 
avatar for Aesica Aesica 951 posts
Flag Post
Originally posted by fons912:

then how to increase the value if eaten battery?

If you’ve eaten a battery, I suggest a quick trip to the ER. Sure would suck to pass a bunch of D cells!