Under rating threshold (hideshow)
My healthMeter wasn't working until I added "resetHealth();" in the "function onLoad()" [--> Ship.as].
Perhaps this could help somebody.
Under rating threshold (hideshow)
Okay there how i solved my problem with health bar:
1.Create the healthMeter layer (i'll call it hMl)
2.On the hMl, create a New Symbol(Insert>New Symbol).Name it "HealthMeter"(Movie Clip that's all anything else) and click Ok.
3.Now "HealthMeter" is in your library, double click on it.You'll go inside.
4.There is a empty layer, just create 2 others and you'll have 3.Name them from upper to bottom:border,bar,backdrop.
5.Draw your Healthbar now:
-On border layer: draw only border without anything inside.you can draw it with flash tools but you can import from png file too.
-On bar layer:you have to draw the green rectangle with Flash.
-On backdrop layer:draw a white rectangle or obmit it if you want it transparent (this layer isn't important).
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)
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)
guys, kongregate forgot this in their last tutorial, but before any time you call removeMovieClip() inside your enemy class, you need to remove it from your array of enemies. Otherwise, bullets will continue to try running checks on the nonexistant objects, and the array will just grow longer and longer.
i created an index variable inside the enemy class that I update whenever things are removed from the array and use before .removeMovieClip() like this:
_root.(array name).splice(index, 1);
Under rating threshold (hideshow)
For those with score issues:
1: test your score-display by putting
_root.ship.score += 50;
_root.scoreText.text = _root.ship.score;
in your Explosion (before this.removeMovieClip)
- In game it should automatically start with a 0 and rise with every explosion.
- If you got that to work. You probably made a mistake when placing the resetScore and updateScore functions. They should be under the onEnterFrame function (not in it!)
- go over all of your {}
Under rating threshold (hideshow)
grrrr. none of this works :(
ive made it exactly. no errors. but nothing at all works. the health meter doesnt go down. score doesnt go up. :(
its really disapointing because all the others have worked so far
Under rating threshold (hideshow)
6.Select the bar layer and Modify>Covert to Symbol. Name it "Bar".Registre it to left and press Ok.
7.Single click on the "bar Movie clip" on edit mode and change his instance to "bar" and there must be instance of :Bar then let it
8.Go back on the Scene1,drop off HealthMeter(from library) on the stage and place it on the left corner(or anywhere you want)
9.Change his instance to "healthMeter" and check if "instance of:healthMeter" is right.
10.Add "health=100;" inside function onLoad() from class Ship.
11 it should work :)
Under rating threshold (hideshow)
Alright, I was having this problem but a comment below helped me. I'm bumping it so other people will see it:
I don't know about other people but I couldn't get my score to show except for blank, 0, and 00. Somehow I fixed it by typing 0123456789 in the text box. I hope this helps someone...
Under rating threshold (hideshow)
Ok... last bit.... 13. Reselect the healthMeter (with the border/bar/background layers) and with the green rectangle selected set the instance to "bar". 14. Now return to the Stage and from the library drag and drop the healthMeter onto the Stage wherever you wish it to be. 15. Finally set the instance name to "healthMeter". Enter the script code is as per the tutorial.
Under rating threshold (hideshow)
Continued... 8. Create another rectangle as above but coloured green. select it and set the X & Y oordinates to 0 and the Width and Height to the same as the background rectangles values. 9. Now insert another timeline layer and call it "border". 10. Change to the Pen tool and draw around the edge of the rectangles. NB. to get the "wiggly line" effect you will need to set the pen mode to "Ink" - I'll let you find that :-) 11. Now select ONLY the green rectangle you drew (hint - it's on the "bar" timeline level) and click Modify| Convert to Symbol. 12. Change the name to healthMeterBar and set the registration to the middle left square. to be continued...
Under rating threshold (hideshow)
Here's how I created a health bar (NB. I use CS4 so there may be minor differences in menus etc.) It's a rather long comment so I've broken it into sections... 1. Create a new layer in the time line and call it "HealthLayer". 2. With HealthLayer selected select the Insert | New Symbol menu option. 3. Make the name healthMeter and click Ok. 4. On the timeline edit the layer name to "background". 5. Draw a rectangle with the border and fill the same colour (e.g. light grey) 6. Select all of the rectangle and set the X and Y coordinates to 0. The Width and Height are your choice. 7. Insert a new timeline layer and call it "bar". To be continued....
Under rating threshold (hideshow)
this is by far the worst shootorial so far.
especially for those who can't open the source files (the actionscripts work, just not the .fla) so we're forced to make a health bar and game over menu which the instructions "just do it"
i did manage to work my way through, but if anyone can tell me why my health bar ends outside of the outline, rather than at the end of the outline, that'd be great. i'll try to work it through myself in the meantime
Under rating threshold (hideshow)
Everything is perfect except the health meter doesn't move, I still get the game over thing, but it just doesn't move, it stays green, can anyone tell me how to fix this?
Under rating threshold (hideshow)
I made some modifications in the programming gameplay-wise. One of those was creating a resetPosition() function, so your ship doesn't spawn exactly where it was killed the last time (since I made the game considerably harder with faster enemies and stuff, yeah, this is an issue.). If someone want to make it just create the function and declare the this._x and this._y wherever you want your ship to spawn. Cool stuff: if you remove this.removeMovieClip from the colision test against your shot, you have a piercing shot upgrade. =P
Under rating threshold (hideshow)
If your score and health doesn't work, you probably need to put the functions for updating each
one at the beginning of the class an under the variables. It worked for me after I did this. This is probably different from as3, idk.
Under rating threshold (hideshow)
for those who struggle with a game over menu, try making it in a seperate frame on the root timeline. then right click on both frames and type stop()
On the death function for you ship, rather than showing the game over menu, put _root.gotoAndStop("The frame with game over in it") similiarly with your button, make one, give it an instance name on the game over menu and type into the frame actions
"button's instance name".onPress = function()
{
gotoAndStop("Frame with main game on it")
}
Hope this helped!
Under rating threshold (hideshow)
it says there is no property called health on several lines of my ship class. this causes the whole game to notr work
Under rating threshold (hideshow)
Ok i understand that the gameOverMenu musnt be exported to actionscript, however it still doesnt show up when my ship explodes!! FFS
Under rating threshold (hideshow)
Please help! My score won't show up! I shoot an enemy, and the score either changes blank, 0 or 00. Help me!
And how do you make a game over menu?
Under rating threshold (hideshow)
:( Apparently I messed up on the score and kept getting something about classes - I couldn't test. I spent 3 hours comparing my script to the examples. It all seemed correct. Then I undoed many times to an effort to undo what i did wrong. I ended up back where I couldn't hit enemies with missiles :( and I saved before I found out. >.<
Under rating threshold (hideshow)
I'm having Problems with the healthMeter / Bar i don't know how to add the bar to the healthMeter. Can somebody explain this to me?
Under rating threshold (hideshow)
This tutorial is very bad. It doesn't explain any of the mechanics of the health meter ("just copy it or make it yourself"), and even the copied one doesn't work.
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)
go to this link for the health bar
http://adobe-flash.wonderhowto.com/how-to/create-enemy-and-health-bar-for-flash-rpg-158386/
Under rating threshold (hideshow)
@silent22 you can make a new function similar to the explode(); function that dosen't give you points, and you can call that function instead
Under rating threshold (hideshow)
Less good episode, instead of 5-25 minutes took me 2h+ to finish page 8....
------------
The Score and Health code for the Ship class needs to be under the functions {velocity = 10;, shootLimiter = 0;, enemyTimer = 0;...} under the "function onLoad()". Look at screen shot to see where I put it.
Under rating threshold (hideshow)
I cant figure out how to fix the PLAY AGAIN button. Could someone explain in detail how they incorporated the PLAY AGAIN button? I used a Text Box and the coding provided. Ty for help
Under rating threshold (hideshow)
Is there a way to make it so that the enemies don't give you points when they explode when you die? And great tutorial.