ActionScript 1/2 :: Make A Health Bar - Doesn't Clear The Timer
Feb 25, 2010I'm trying to make a health bar, it does down when you press a button. I used a timer. But it doesn't clear the timer, it just keeps on going.
[Code]....
I'm trying to make a health bar, it does down when you press a button. I used a timer. But it doesn't clear the timer, it just keeps on going.
[Code]....
I'm working on a game whose background has many layers that each scroll at different speeds.
Inside each layer I have a Sprite, I've started using graphics.beginBitmapFill, but what I've found is that the graphics.clear() function doesn't actually clear the contents set by the previous call to graphics.begin.BitmapFill. Each frame, I adjust the matrix to shift the layer as needed. Then, I call graphics.clear() and graphics.beginBitmapFill() with the adjusted matrix. Since my layers have alphas in the bitmap, I can see the contents that was drawn the previous frame.
Im making a shooter. I want my player to have health. Its similar to galaga. The player instance is PlayerShip and the shot from the alien is AlienShotT i want 100 health and -10 health per alien shot.
View 1 Replies[Code]...
doesnt clear the line when mc1 moved ? How solve tihs problem?
Alright, so after some work and a lot of mistakes, I made a health bar for my game. (This is in Actionscript 2) Basically, the code is on my main character's .as file, there is var maxHealth : Number = 100; var health : Number = 100; and further down the line... _root.healthBar._width = (health/maxHealth) * 200;.As a result, when I change the var health number lower, the health bar goes lower. Sweet! It works! Now I was wondering if any of you guys could help me code it so an enemy can inflict damage upon the main character. I have tried many codes but they have all failed. if(this.hitTest(_root.Monster)) { } What would I put in the brackets?
View 3 Repliesi am a newbie in AS3 or should i say a total noob in actionscripts and flash itself.Currently i need help on how to make a health bar.Basically i need to make a health that decrease over time when the mouse clicks on it. Meaning:Example when there are like 4 objects, A,B,C,D A and B are objects that help that player score points and C and D are objects that make the health bar goes down. By using mouse event, i must make it able to detect the clicking when the object is being clicked.
View 2 Repliescodes regarding on how to create a health bar and stamina barfor example when you move your character sideways the stamina bar decreases.
View 1 RepliesI am making a flash game for a school project, and I decided to make a stick fighting game.once the enemy attacks the player their health just drains. The only way I can fix it is if I have a decimal instead of a whole number, but I have the variable of the health in a text box to display the players current health and it doesn't look to good with a decimal number.So, I am wondering if there is a way to make the health decrease by a decimal, but show a whole number in the textbox.[code]
View 2 Repliescan any of you point out if this code is wrong or do I have a bug in my Flash? It's sopposed to be a simple move function, called by an interval, and after reaching the border of the film, it's sopposed to stop. pretty simple, right? right, but theHere's the code I've used: (mcBall = 1 framed movieClip)
_root.onEnterFrame = function()
{
function fMoveIt():Void
[code].....
i have used the setinterval in a module. i clear the inetrval each time i make it using a function in other class. on long time run the clear interval stops functioning.
View 1 RepliesI need a tutorial on how to create a "health bar" - I don't have a better word for it, but my idea is to have a bar (showing hapiness of a pet), and each time you push a button - the pet gains hapiness - and the "health bar" grows. What is this called, and is there a guide I can read telling me how to create such a code?
View 6 RepliesI have a function in which all items of an array are processed. in part one of the code I have a certain function called immedietly for ever item, but after that, a function is made within this function, to be added to a timer. the function will be executed 500 milliseconds later. this works fine most of the time, but sometimes the function with 500 mill delay doesn't get executed at all, while the first part does.
Can the cause of this problem maybe be, that there is a limit to the amount of Timers, or nested functions?
This is the function:
PHP Code:
if (ballsWillBeMatchedOut.length >0)
{
//part one:
for (i = 0,num = ballsWillBeMatchedOut.length;i<num;i++)
[Code].....
i am having a problem with my flash animation game timer and nothing seems to work
i want it so that when the time reaches 60 seconds and the score is over 200 it will go to the frame gameWon if its below it will go to gameLost. i also am struggling to make the timer show up on the animation game.
[Code]....
Why WebCam snapshots doesn't execute by timer?
ActionScript Code:
capture_mc.buttonMode = true;
capture_mc.addEventListener(MouseEvent.CLICK,captureImage);
[Code].....
this part of code works well without errors but when I click button I have a picture bu timer It doesn't.
Having a little issue here with TIMER, basically I am looking for the timeline to advance 1 frame after 3 seconds, OR on MouseEvent.CLICK advance to next frame (before the 3 seconds it up). Which would then reset the TIMER. So, on CLICK go to next frame, OR wait 3 seconds and go to next frame (while having the TIMER reset both times). So...
Wait 3, (timer resets) wait 3, (timer resets) CLICK, (timer resets) CLICK, (timer resets) CLICK, (timer resets) wait 3, (timer resets)wait 3, (timer resets)CLICK, (timer resets)CLICK... You get the idea.My issue is the timeline, over time the TIMER time doubles, it doesn't reset... I am sure this is pretty basic and I am over thinking.
[code]...
I'm using the Actionscript Timer class. What happens if I run a function every 3 seconds, but the function takes 4 seconds to complete? Does the Timer object queue up events? I guess this must happen if only 1 thread is being used?
View 1 RepliesIm a complete noob to flash cs5 and i was wanting to make a small animation. For this i need a delay between each frame. I tried using the prebuilt actionscript code since my for loop delays were horrible. But i keep getting this compiler error:
Code:
Scene 1, Layer 'Layer 1', Frame 2, Line 91120: Access of undefined property f1_SecondsElapsed.
[code].....
I'm using the following method to dispatch a sound in X times/minute (X is determined through bpm, which is a NumericStepper object)
var mainTimer:Timer = new Timer(60 / (bpm.value * 1000),0);
mainTimer.addEventListener(TimerEvent.TIMER, fl_TimerHandler,false, 0, true);
mainTimer.start();
[code].....
I'm trying to make a countdown timer, but I haven't really learnt all about actionscript. (not yet anyway), but I need a timer that can count down the hours, minutes, seconds and milliseconds from a given time to an other.
I need the start timer to say:
01:31:53:70 (hour:minutes:seconds:milliseconds) and then it should count down so the timer stops at:
01:30:00:00
how to make a countdown timer in actionscript 3? I have tried several ways and have so far been unsucessful.
View 8 Replieshow I can put a stopwatch or a timer in my animation? I know how to do the digital clock, but I don't want it to tell me what time of day it is, I want it to time the actions of my clips on the stage.
View 5 Replieshow I can quickly make a 5min countdown timer with as3. All I can seem to find is a countdown to the current date and time.
View 14 Repliesi need to make a timer or counter?it is going to be for a project were people donate money to help kids in need, so i need to make something that looks like it is real time adding up the amount so far donated. there is no way for me to give the real amount because it would be changing so fast so we just want something that say starts out at a number and goes up by 5 cents an hour.
View 1 RepliesCode: www gieson com/Library/projects/utilities/countdown/ I need one like the 30 second countdown where it's like a airport ticker. Anyone with a fla of this?
View 3 RepliesHow do you create a simple Health Bar for Actionscript 3.0? I have been searching for this for a while, and all I ever find are AS2 tutorials. AS2 dates back to about 900 B.C. ; it is an archaic language and it needs to be left alone, FOR GOOD.
-Snivvle
--------------------------
"AS2 is for dinosaurs" - Snivvle, 2008
"AS2 is for people who are afraid to evolve" - Snivvle, 2009
"AS2 is for people I want to punch" - Snivvle, 2009
how to make a countdown timer? I created a timer that counts down to a certain date, but I just want the timer to countdown 24 hours, not to a certain date. I also want to have a button below the timer so that when you click it, it adds 30 seconds to the timer
View 6 RepliesI'm trying to make a countdown timer with milliseconds. I'm using this site w w w .emanueleferonato. com/2007/02/19/flash-simple-timercountdown/ for the code and it works fine (except I don't know how to make it stop at 0). Now I'm trying to add more items, such as music and a changeable background, to the countdown page and end up with errors.
Is there somehow I can add new frames to the background layer without the song playing over each other when I preview it? Also how can I make a button appear after it has hit 0 so I can click on it and lets me leave the countdown page?
gotta clock that goes from 60seconds-0secondsthats the code it works finebut i cant find out how to make it go to the next scene when it hits zero i tried code 2 but it doesnt work
//CODE1
counter = 60;
setInterval(countDown, 1000);
[code].....
How do you create a countdown timer on an animated game, so that when the time gets to 0 and depending on your score it ttakes you to a losing page or a winning page.[code]...
The other two frames are called gameWin and gameLose, so depending on the score within the 60 second countdown, how would i make it go to there frames and how would i make the time show up on the page.
i have an apple and the character the character can walk over and touch the apple when he touches it he gets 30 random health but then if he health is already 100 the apple will give him 130. ??? is their any way to make it so his health doesnt go past 100
heres the code on the apple
PHP Code:
onClipEvent (enterFrame) {
}
if (this.hitTest(_root.char)) {
[code].......