function updateHealth(points) {
health += points;
if (health<1) {
health = 0;
_root.gameOverMenu._visible = true;
explode();
}
_root.healthMeter.bar._xscale = health;
}
thats the update health ive got and this... function resetHealth() {
health = 100;
_root.healthMeter.bar._xscale = 100;
}
heres how u shud do the helth bar, when you are making it, right off make 3 layers, the lowest called "backdrop" this will be the layer showing after damage is taken, the second layer, the bar, for that you make a separate movie clip not exported for actionscript, named "bar" NOTE: when making the bar make sure the image center is aligned to the direction your bar will move! (I.E. when aligned to the left, damage will make the bar go that way) then the last layer, i called it cover, this will be like an artsy "cover" I had a sort of flame one for mine, looks cool. thats the way to make the actual bar, THEN in the coding the update health will look like this, im not sure if my code is farther than this tutorial lvl but whatever
also for the enemy ships be sure to put in code to make you lose health such as... if(this.hitTest(_root.ship))
{
if(_root.ship.shield._visible==false){
_root.ship.updateHealth(-10);
}
if(_root.ship.inferno._visible==true){
_root.ship.updateHealth(+5);
}
explode();
}
although this code includes a custom powerup i made called inferno, makes you take half damage, of course it wont work without the other coding I got. hope this all fits and works, sorry for the huge post.
@mittensbrother
AS2, I recently tried something similar to this on AS3 but there are several bugs that I need to work out first, I do have enough on AS3 to make something with a ball that doesnt have any actions other than move :P I might upload that just to not have a really poor game on my tab but I would really love to finish this.
@omegnight
well the code only allows me to have 1 platform and the hit test is activated when my character hits the blue line of the movie clip art, since it is inside the movie clip art you are able to jump infinitley, sadly any type of other variable or changes I make to my touchingGround variable makes the rest not work. also @DJ iLLY that will come once I get the proper form of hit test going on.
before you comment, please be aware that this is not completed yet, and was only uploaded to get advice and help. and is short so that it does not annoy, and is quick to get to the important part
omgees! bowling ball!, also did you use the tutorial from basics platform game tutorial? nobody seems to be able to help me with the platforms and it looks like youve got it down, if you get this message leave me a whisper if your interested in helping me thanks!
ahahaha he flaps!, well that aside, im working on a platformer myself, and I noticed you commented on a tutorial a while ago, it was a platformer tutorial, anyways, im going to leave you with a whisper something similar to this pretty soon.
gah the script looks good but my guy just hits the ground and falls through, I made sure it wasnt water and made sure the code wasnt thinking it was water, has anyone found a way to fix this?
for the platformer, its way to messed up you either need to clean it up or help us find a way to get it to work with the codes from the super duper tutorial, which im working on right now
@legorlan I have actually added wingmen permanently to my ship and sometimes its a bit hard to put the code together without simply copy+paste all of the regular ships code, it will spawn more enemies and such, for the wingmen you may need an "if(_visible..... and set is so the damage and effects only work when visible, for my wingmen I make them move rather than follow my coordinates, so it also has its own key.right blah blah blah. with wingmen you just need to experiment until you find out how you can work flash logic to your liking.