문제

How do I get accurate counting? My game has is a pass or fail scenario based on time. I need an equation that will work in ActionScript.

'Commence escape within 30 sec or lose 600 life points' ...you see only readout of lifepoints, but time needs to be accurate

I'm not attached to this, it's just an example

var CURRENTCOUNT:int = 0;
var EQUA:int;
//WHERE I WANT TO PUT LINEAR EQUATION
EQUA = 34;//<==EQUATION GOES HERE???
var SPEED:int; 
SPEED = EQUA;
var COUNTDOWN:Number = 600;
var COUNTUP:Number = 0;
//TIMER
var myTimer:Timer = new Timer(SPEED,600);
myTimer.addEventListener(TimerEvent.TIMER,someFunction);
myTimer.start();
//INCREMENTING++
function someFunction(event:TimerEvent) {
//COUNTDOWN stops count going down, COUNTUP stops count going up
CURRENTCOUNT = COUNTDOWN - myTimer.currentCount + COUNTUP;
//Testing with only a text string to rule out cashing issues 
tx.text = String (Math.abs (CURRENTCOUNT));
}

I've tried this

SPEED=DISTANCE/TIME

In place of currentCount, but it's not any more accurate. It adds acceleration

//VoVf
V++;
COUNT = V*V/X;

30 seconds and 600-0 lifepoints and counting I wanted to explain, because it's not a clock. It's pass or fail. They look at there life drifting away.

Description of lifecount. Scene with Death holding a steampunk style timer or gauge and laughing:

  • Player has so many seconds to escape '30 seconds
  • Lifecount displays loss of players total life '600
  • Player can choose between more power or more life if they make it out alive
도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top