Be a Supporter!

Timer/Points Help!?

  • 343 Views
  • 9 Replies
New Topic Respond to this Topic
MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Timer/Points Help!? 2009-03-18 17:41:36 Reply

Ok so I want to make a score box ( static text i guess), that after ever 30 frames it adds 1 point to the score box. I have a vague idea of how to do this, but I need some help, anyone? Action Script 2 by the way.

And the movies at 30fps.

And i was thinking could i add some actionscritp on the main timeline every 30 frames, thats like: ...+1..

**Sorry for the other post too**

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Timer/Points Help!? 2009-03-18 17:44:34 Reply

At 3/18/09 05:41 PM, MilkMan268 wrote: Ok so I want to make a score box ( static text i guess), that after ever 30 frames it adds 1 point to the score box.

No, dynamic textbox. Var: score

And the movies at 30fps.

Main timeline:

cnt=0;targ=30;score=0
onEnterFrame=function(){
	cnt++;
	if(cnt>=targ){
		score+=1;cnt=0;
	}
}

Untested


- - Flash - Music - Images - -

BBS Signature
MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Timer/Points Help!? 2009-03-18 17:51:53 Reply

At 3/18/09 05:44 PM, Denvish wrote:
At 3/18/09 05:41 PM, MilkMan268 wrote: Ok so I want to make a score box ( static text i guess), that after ever 30 frames it adds 1 point to the score box.
No, dynamic textbox. Var: score

And the movies at 30fps.
Main timeline:

cnt=0;targ=30;score=0
onEnterFrame=function(){
cnt++;
if(cnt>=targ){
score+=1;cnt=0;
}
}

Untested

So is that place on every 30 frames, or just on the first one?
And what do I put on the first frame to reset the variables?

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Timer/Points Help!? 2009-03-18 17:54:59 Reply

At 3/18/09 05:51 PM, MilkMan268 wrote: So is that place on every 30 frames, or just on the first one?
And what do I put on the first frame to reset the variables?

Just the first one
Any time you want to reset the variables, just use the first line of the code I gave


- - Flash - Music - Images - -

BBS Signature
MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Timer/Points Help!? 2009-03-18 18:20:35 Reply

Dosen't seem to work, I did everything right. The instance I put as score? Isn't that correct

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Timer/Points Help!? 2009-03-18 18:27:18 Reply

At 3/18/09 06:20 PM, MilkMan268 wrote: Dosen't seem to work, I did everything right. The instance I put as score? Isn't that correct

No, not the Instance Name. The var for the textbox

Timer/Points Help!?


- - Flash - Music - Images - -

BBS Signature
MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Timer/Points Help!? 2009-03-18 19:02:17 Reply

Yes! Everythings perfect now, but the stupid mouse effect thing, its an animation and I guess the timer is counting that too. Any fixes?

MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Timer/Points Help!? 2009-03-18 19:11:51 Reply

Wait, thats one thing but another is how do I get it to stop, but keep the number in the box, so you can enter it into the leaderbaords?

Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Timer/Points Help!? 2009-03-18 19:40:52 Reply

At 3/18/09 06:27 PM, Denvish wrote:
At 3/18/09 06:20 PM, MilkMan268 wrote: Dosen't seem to work, I did everything right. The instance I put as score? Isn't that correct
No, not the Instance Name. The var for the textbox

Old school


- Matt, Rustyarcade.com

MilkMan268
MilkMan268
  • Member since: Oct. 14, 2007
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Timer/Points Help!? 2009-03-18 20:11:31 Reply

Maybe something like, start that script on frame 2?