0

hi I''m currently making a flash AS3 game (didnt focus on the graphics yet just want to have a good start on my game)

so yeah the idea is that this will look like something like this...

I'll add my .as and .fla files below so you can have a look at whats made till nowand maybe give me some additional tips what I should change to make it work better ifit doesnt >.<

so back to the point :P
I've stumbled upon a point when I couldnt find a tutorial that would explain what i was searching for . I was searching for a tutorial that could explain How to make the time count up how many seconds a player spent before he died.

I also want it to display on the "lose" screen

my apologies for my bad English and thanks for the help

greetz

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by rajarajan07
-1

Really, you should try to learn AS3 before you try to make a game.
To count:

//make a number variable:
var counter = 0;
//you don't need to make this two variables, but I write
//it for you to make it easier to understand:
var FPS = 40 //How many frames per seconds your document has
var loseScreenFrame = 3 //On what frame the lose screen is
//make it count:
/pseudo, cause I only know AS2:
onEnterFrame {
counter ++; //makes the var counter increase with 1 every frame.
}
//in the win/lose menu: showing how long the player lasted:
myTextField.text = counter/FPS + "seconds"; //write the seconds to a textfield, (convert counter to seconds (by dividing with FPS))

//to go to the loose frame:
gotoAndStop(loseScreenFrame); //go to and stop on the frame that the lose screen is on.

This is very basic, and i hope it helps!

0

hi I''m currently making a flash AS3 game (didnt focus on the graphics yet just want to have a good start on my game)

so yeah the idea is that this will look like something like this...

I'll add my .as and .fla files below so you can have a look at whats made till nowand maybe give me some additional tips what I should change to make it work better ifit doesnt >.<

so back to the point :P
I've stumbled upon a point when I couldnt find a tutorial that would explain what i was searching for . I was searching for a tutorial that could explain How to make the time count up how many seconds a player spent before he died.

I also want it to display on the "lose" screen

my apologies for my bad English and thanks for the help

greetz

I'm just learning Flash, but I recall looking at this site recently and seeing some AS3 code regarding timers. Take a look: http://flashgameu.com/

0
var min:int;
var sec:int;
var losetime:Boolean=false;
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, clock);
timer.start();

function clock(e:TimerEvent):void{
	sec++;
	if (sec>59) {
		min++;
		sec=0;
	}
	if (losetimer==true) timer.stop();
	trace("Min:Sec - " + min+":"+sec);
}

Hope its helps!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.