ForumsProgramming ForumIs it possible to set numeric variable limits? (In AS2)

6 3491
SpyreWorks
offline
SpyreWorks
172 posts
Nomad

I'm kinda new to flash and actionscript so I'd like to know...
I'm making an RPG game, and at the beginning of course, you can pick on what attributes to spend your points on.
There are 4 attributes that all start on 0 and there are 12 points available to spend.

How would I go around doing this?

Or more specifically, can I make a numeric variable not go any higher or lower than a specific number?

Any help would be appreciated.
Remember, this is in AS2.

  • 6 Replies
LennonTheMage
offline
LennonTheMage
55 posts
Nomad

Email me and I can help you with this check my profile for email : )

dank
offline
dank
986 posts
Peasant

if statements.

That was easy

SpyreWorks
offline
SpyreWorks
172 posts
Nomad

Would you be so kind as to be more specific/exact please?
I'm not very good with ActionScript.

LennonTheMage
offline
LennonTheMage
55 posts
Nomad

I've sent you the email and remember any questions about anything else I'm happy too help with : )

dank
offline
dank
986 posts
Peasant

So you have a variable and another variable that limits it:
var someNum:Number = 5;
var MAXNUM:Num = 10;

Then you have some line(s) that changes it:
someNum++;

Then you have another line that checks it for its max:
if(someNum > MAXNUM)
someNum = MAXNUM;

SpyreWorks
offline
SpyreWorks
172 posts
Nomad

Thanks guys, everything's working now!

Showing 1-6 of 6