倒计时和生命点,as3

发布于 2024-09-06 18:10:36 字数 1215 浏览 7 评论 0原文

如何准确计数?我的游戏有一个基于时间的通过或失败场景。 我需要一个可以在 ActionScript 中运行的方程式。

“在 30 秒内开始逃跑,否则会损失 600 点生命值” ...您只能看到生命点的读数,但时间需要准确

我不喜欢这个,这只是一个例子

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));
}

我已经尝试过这个

SPEED=DISTANCE/TIME

代替 currentCount,但它不再准确。它增加了

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

30 秒加速和 600-0 生命点以及我想解释的计数,因为它不是时钟。是通过还是失败。他们看着生命渐渐远去。

生命计数的描述。死亡场景拿着蒸汽朋克风格的计时器或仪表并大笑:

  • 玩家有很多秒的时间来逃脱'30秒
  • 生命计数显示玩家损失的总生命'600
  • 玩家可以选择更多的力量或更多的生命如果他们活着出来

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文