Okay first - for the HUD yes, simply separate it in a different layer (and perhaps contain all of the elements within one single movie clip with its own layer construction and action script within.)
If you are still interested have a play around with this code to make a health bar system here is a quick layout of how it works (i will make a full tutorial later):
Place this code on the first root frame of the scene-
Code: Select all
stop(); // So that the frame does not skip/loop/or go to another frame (we want to stay on our first frame)
health = 100; // Variable defining the original amount of health
mana = 100;
onEnterFrame = function(){ //basically creating a looping check for the inside properties we set
if(mana <= 0){ //defining laws for mana (to not allow it to pass below 0 in value)
mana = 0;
}
else if(health >= 100){ // same thing as above but just not allowing health to rise above a 100
health = 100;
}
// The following is to a dynamic text box "health_txt" (or mana_txt) which displays the amount of health/mana the player has left. We round it and add % sign to make a percentage
_root.health_txt = Math.round(health)+"%";
_root.mana_txt = Math.round(mana)+"%";
//The following simply defines that if health == 0 (or you could use <= 0 if your damage varies greatly) then the loop ends and the movie goes to the next "dead" frame
if (health == 0){
delete onEnterFrame;
play();
}
}
Code: Select all
onEnterFrame = function(){ //again we start out with this as before
health_bar._xscale = _root.health; // the actual movie clip for the bar you make which scales the clip horizontally in proportion to the health variable (defined with a _root.health since we have to connect to a variable outside the local movieclip).
if(health_bar._xscale >= 100){ // we are just defining constraints so the bar does not get longer than 100% of is possible size
health_bar._xscale = 100;
}
}
onEnterFrame(); // once it has all been filtered we do this to update the variable info / and bar sizes
Back to your question regarding integrating with halls tutorial. Okay I have not personally gone through his tutorial series so I dont know how it works yet (this is on my agenda) - however integrating flash with it I think is difficult for still a beginner with it. - it can be done and I figure I know how to and will eventually slap a tutorial out about it. But basically -
Since I am not sure how the php/html side of this handle the variables of players etc.
Inside the flash you have to call upon the php variables / etc and handle them in there by when you select a race it sets those variables -
SO first introduce your php variables from your local php file-
Code: Select all
onEnterFrame = function() { //again we want this to happen again and again - since this is online and we want these variables to update in and out
// Assign the directory and rest according to your own set up
loadVariables("directory/folder/filename.php", this, "GET");
}
onEnterFrame();
Code: Select all
on(release){
playerRace = $race1
}
Not sure if this helps you much - it is extremely difficult to encapsulate it ALL like this for personal use. You really have to get used to flash before you can do this the way you probably want. But nonetheless give it a shot ... ah and i also found this - http://www.kirupa.com/developer/actions ... mysql2.htm it may help you with the flash/php business.

