Be a Supporter!

Any idea why this isn't working?

  • 357 Views
  • 8 Replies
New Topic Respond to this Topic
UnrealCanine
UnrealCanine
  • Member since: Feb. 6, 2008
  • Offline.
Forum Stats
Member
Level 19
Game Developer
Any idea why this isn't working? 2009-08-16 11:41:53 Reply

var killcount =0;
_root.wave = 1;
onEnterFrame = function() {
if(_root.killcount>9 && _root.killcount<20){
	_root.wave = 2;}
}

Upon getting 10 kills, it's not setting the wave to 2

FlashtooREV
FlashtooREV
  • Member since: Jun. 9, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 11:49:01 Reply

Works fine to me.
My testing code:

var killcount =0;
_root.wave = 1;
onEnterFrame = function() {
	killcount ++;
	text1.text = "Kills = "+killcount +" Wave = " +wave;
if(_root.killcount>9 && _root.killcount<20){
	_root.wave = 2;
}
}

Dynamic text box text1 shows that the killcount increases and wave increases to 2 once the killcount's more than 9.


Ceterum censeo Carthaginem delendam esse.

max15946
max15946
  • Member since: Aug. 19, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 11:49:11 Reply

i don't see a ten in that code so that could be the problem


Castle Crashers Collab Programmer

BBS Signature
FlashtooREV
FlashtooREV
  • Member since: Jun. 9, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 11:50:47 Reply

At 8/16/09 11:49 AM, max15946 wrote: i don't see a ten in that code so that could be the problem
if(var > 9)

Equals

if(var >= 10)

Or in words:
if var is more than nine
equals
if var is more or equal to ten

:)


Ceterum censeo Carthaginem delendam esse.

max15946
max15946
  • Member since: Aug. 19, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 11:53:06 Reply

oh cool i don't think i will need something like that soon but it is nice to know.


Castle Crashers Collab Programmer

BBS Signature
FlashtooREV
FlashtooREV
  • Member since: Jun. 9, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 12:03:06 Reply

At 8/16/09 11:53 AM, max15946 wrote: oh cool i don't think i will need something like that soon but it is nice to know.

It's basic number variable checking. If you want to make games, you almost HAVE to use it.


Ceterum censeo Carthaginem delendam esse.

UnrealCanine
UnrealCanine
  • Member since: Feb. 6, 2008
  • Offline.
Forum Stats
Member
Level 19
Game Developer
Response to Any idea why this isn't working? 2009-08-16 12:32:04 Reply

Well I couldn't understand the problem, especially as you said it was alright, so I did a bit of fidddling and solved it by thinking outside the box

FlashtooREV
FlashtooREV
  • Member since: Jun. 9, 2009
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Any idea why this isn't working? 2009-08-16 12:42:16 Reply

At 8/16/09 12:32 PM, UnrealCanine wrote: Well I couldn't understand the problem, especially as you said it was alright, so I did a bit of fidddling and solved it by thinking outside the box

Meaning...?


Ceterum censeo Carthaginem delendam esse.

UnrealCanine
UnrealCanine
  • Member since: Feb. 6, 2008
  • Offline.
Forum Stats
Member
Level 19
Game Developer
Response to Any idea why this isn't working? 2009-08-16 17:43:52 Reply

At 8/16/09 12:42 PM, FlashtooREV wrote:
At 8/16/09 12:32 PM, UnrealCanine wrote: Well I couldn't understand the problem, especially as you said it was alright, so I did a bit of fidddling and solved it by thinking outside the box
Meaning...?

Changed the wave counter to a movie clip (which allows me to add a cool little animation upon getting a new wave), and added a _root.wave=2; to the second frame on that