Jump to content
Serguei2

Dealing with 255 limit

Recommended Posts

I noted when a variable reaches near 255, it drops to lower number.

 

How to make variables (scores) over 255?

Share this post


Link to post
Share on other sites
Posted (edited)

use int instead of byte when delcaring it

 

byte score=255;  //max

int score =32767; // max -32768 to +32767

 

 

Edited by digress

Share this post


Link to post
Share on other sites

I get 'Turn game off' message instead loading my game. 

 

If I use both byte score=255; and int score =23768; I get

 

 error 0: Duplicate symbol 'score', symbol IGNORED

 error 177: previously defined here

 

 

Share this post


Link to post
Share on other sites

It works. 

 

I wrote int score=32767; instead int score;

 

My mistake.

 

Thanks guys

 

My game works fine now.

Share this post


Link to post
Share on other sites
Posted (edited)

also don't define the score ouside of a routine with a value or it'll be permanant hardcoded and cannot be updated.

 

global variables defined outside any routine just define the type and assign a value before use .

 

int score;

 

later....

game_routine()

{

score=0;

}

 

 

score can have a max of 32767 . there are other types if you need a higher total.

Edited by digress

Share this post


Link to post
Share on other sites
1 hour ago, digress said:

also don't define the score ouside of a routine with a value or it'll be permanant hardcoded and cannot be updated.

 

global variables defined outside any routine just define the type and assign a value before use .

 

int score;

 

later....

game_routine()

{

score=0;

}

 

 

score can have a max of 32767 . there are other types if you need a higher total.

Yeah. The other type is unsigned from 0-65535.

 

For my first game, I would use 5 digit, even if most games have 6 digit.

 

This community has great players with high scores, just take a look at the high score club.

 

I don't want to limit at 65535. Skillful players want to reach the highest score possible.

Share this post


Link to post
Share on other sites
1 hour ago, Serguei2 said:

I don't want to limit at 65535. Skillful players want to reach the highest score possible.

 

If your game's scoring system doesn't offer anything below 100 points, you can add two static zeros after the score on the screen, and have a score that can go from 0 to 6553500 points.  :)

 

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, Pixelboy said:

 

If your game's scoring system doesn't offer anything below 100 points, you can add two static zeros after the score on the screen, and have a score that can go from 0 to 6553500 points.  :)

 

that's what I did in Super Space Acer ;)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...