Under rating threshold (hideshow)
Gah! Had my health bar working, then went in to tweak it, and now it's not working again! And I can't figure out how to make it work again!
Under rating threshold (hideshow)
RESOLVED - I had a 0 in my scoreText area, so it kept resetting it. Make sure your Score area is completely blank or it'll reset on every kill.
Under rating threshold (hideshow)
Finally, after about 6 hours, I got my score to work.. kinda. It know "reads" and updates on the first kill, but the next kill, it resets. Third kill it updates, 4th it resets. Any idea how I fix that?
Under rating threshold (hideshow)
general comando you will have to get the help by looking at your game here in shootorials nobody helps except other people. you rarely find the correct person.
Under rating threshold (hideshow)
OMFG!!! i just spent about 4 hours trudging through my coding to find out that the reason that my health bar wasn't scaling was that i had put the instance name of as healthBar.bar and then refered to it in my code as _root.healthMeter.bar PLEASE PLEASE PLEASE be very careful with your instance names. it's an rooky mistake but be vigilant! also be careful as it's picky with capitalisation too... just glad i got it working in the end! :P
Under rating threshold (hideshow)
I'm getting the problem "There is not property with the name score". I pretty sure it is because I am putting the following codes in the wrong spot.... function updateScore(points)
{
score += points;
_root.scoreText.text = score;
} .......and....... _root.ship.updateScore(50); if somebody could send me a private message ti exactly where I am supposed to place this code I would greatly appreciate it.
Under rating threshold (hideshow)
so one of the problems i had with the health bar not moving was i didnt put the
reset health; in the onLoad function
that may solve some probs
Under rating threshold (hideshow)
@ Krinsmnite, you could've done that without redoing the whole bar. Just right click it in your library and select edit. Move the bar so that the left side of the bar is right on the "circle" in the middle. there you go.
Under rating threshold (hideshow)
Ok, figured it out! IMPORTANT: When you first create the bar movie clip, make sure the "Registration" is set with a dot on the left. I didn't know what that meant, so I had to go back and remake the bar. :(
Under rating threshold (hideshow)
Can't see the source code, it's not compatible (unexpected file format). So that leaves me guessing on half of the things I need to do. Google is no help. :( Can someone please explain how I am suppose to align the health bar? It "empties" toward the center.
Under rating threshold (hideshow)
I like it, probably one of the best written tutorials I've seen in some time. Only one complaint, the part about making your own health meter is summed as: "Hey make your own health meter", which might not be as helpful to noobs who are here to learn 2 Flash. Perhaps a quick description on how to build the meter (i.e are they all separate movie clip objects that are just stacked on each other, or are they some sort of combined unit?) would help out. Otherwise, 4/5 and I hope that I can post a hilariously noob shooter game of my own soon using your guide.
Under rating threshold (hideshow)
256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie.
WTF?!?!?!!??!?!?!?!
Under rating threshold (hideshow)
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.
Under rating threshold (hideshow)
is my reset health one, in the onload part put "resetHealth()" and in the new game function as well. also for this code the health bar on the screen must be named "healthMeter" 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();
}
Under rating threshold (hideshow)
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;
}
Under rating threshold (hideshow)
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
Under rating threshold (hideshow)
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.
Under rating threshold (hideshow)
if your health meter doesn't move, also make sure that your healthmeter on the scene has got the instance name 'healthMeter'. check this in it's properties. i needed 3 hours to find that out -.-
Under rating threshold (hideshow)
My score has decided it hates me, so whenever I explode an enemy instead up updating with the added score it disappears. Anyone else getting this problem?
Under rating threshold (hideshow)
nvm, I got it to work, I just followed the tutorial all over again and it worked! by the way, Putting health=100; in the onLoad function works like a charm.
Under rating threshold (hideshow)
I hade problems with the health bar but this worked for me " Sutafuzz says: Try adding health=100; in the onLoad() function of Ship class. I'm not sure if you're supposed to do that, but it works for me. : ) "
Under rating threshold (hideshow)
Symbol=bar, layer=Layer 1, frame=1, line=1 The class or interface 'bar' could not be loaded.
Symbol=healthMeter, layer=Background, frame=1, Line 1 The class or interface 'healthMeter' could not be loaded.
Ship.as, line 24 Syntax error. function resetHealth()
Ship.as, line 25 This statement is not permitted in a class definition. {
Help pl0x?
Under rating threshold (hideshow)
also its best if you put the points you get from killing an enemy on the missile .as because you could still get points for ramming into the enemy
Under rating threshold (hideshow)
or if (score = 200) {
velocity = 50;
}
sorry about the amount of posts, bumping down possible important info, but hey this would be cool if we can get it set up on this one place, and it would suck if it was covered in a further shootorial
Under rating threshold (hideshow)
here is what I put to try before I got health set up. it doesnt work but if someone can improve on it and let me know that would be cool
if (_root.scoreText.text = 200) {
velocity = 50;
}
Under rating threshold (hideshow)
hey this is a little bit before ive got the health meter part (not entirely sure what the layers mean) im thinking of putting a sort of level up function and im basing it off of an educated guess that this would work
if(score=*put amount here*){
health=+*bigger health amount here*
}
or the same thing but without the + and just put a higher amount does anyone know if that would work? and for the layers, the "bar" layer, will that need to be an exported movie clip as well as the compiled thing?
Under rating threshold (hideshow)
instead of adding the update score as part of the explosion part of the enemy ship class, why not put it as part of the EXPLOSION class itself? wouldnt that look tidier?
Under rating threshold (hideshow)
As soon as I add the function updateScore(points) and I want to test it and go on "test movie" I can't control my ship anymore. when I remove the code, it does.
Under rating threshold (hideshow)
nvm I got it to work so well if I kill 1 enemy I get infinite points (NaN)
btw; this is sarcasm, what im really thinking is "I will find a way to make computers feel pain and them torture them!!!"
Under rating threshold (hideshow)
hey where does the function updateScore(points)
{
score += points;
_root.scoreText.text = score;
} go? it doesnt say and the place I put it doesnt work for some reason
Under rating threshold (hideshow)
@ryanwwong
Yes, it is simple and easy, but you are even more sad to assume everyone has the thinking pattern to figure out codes and variables in flash.
That aside, the tutorials up to this point have been very instructive, easy to follow and helpful!
Under rating threshold (hideshow)
L3M0N4DE & Kafana : Try adding health=100; in the onLoad() function of Ship class. I'm not sure if you're supposed to do that, but it works for me. : )
Under rating threshold (hideshow)
When I take a look at the Games scripting with adobe flash cs4, It shows Absolutly nothing except for stop(). Why can't I see the scripts?