Serguei2 Posted August 7, 2019 Share Posted August 7, 2019 I noted when a variable reaches near 255, it drops to lower number. How to make variables (scores) over 255? Quote Link to comment Share on other sites More sharing options...
digress Posted August 7, 2019 Share Posted August 7, 2019 (edited) use int instead of byte when delcaring it byte score=255; //max int score =32767; // max -32768 to +32767 Edited August 7, 2019 by digress Quote Link to comment Share on other sites More sharing options...
Serguei2 Posted August 7, 2019 Author Share Posted August 7, 2019 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 Quote Link to comment Share on other sites More sharing options...
ChildOfCv Posted August 7, 2019 Share Posted August 7, 2019 Don't declare score twice. Pick a type and use it. He's saying to change the byte type into an int type. Quote Link to comment Share on other sites More sharing options...
Serguei2 Posted August 7, 2019 Author Share Posted August 7, 2019 It works. I wrote int score=32767; instead int score; My mistake. Thanks guys My game works fine now. Quote Link to comment Share on other sites More sharing options...
digress Posted August 7, 2019 Share Posted August 7, 2019 (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 August 7, 2019 by digress Quote Link to comment Share on other sites More sharing options...
Serguei2 Posted August 7, 2019 Author Share Posted August 7, 2019 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. Quote Link to comment Share on other sites More sharing options...
Pixelboy Posted August 7, 2019 Share Posted August 7, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
Tursi Posted August 8, 2019 Share Posted August 8, 2019 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 Quote Link to comment Share on other sites More sharing options...
Serguei2 Posted August 8, 2019 Author Share Posted August 8, 2019 Thanks everybody for the tips. I'll try it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.