Skip to content
kaynak.yzokul.com.tr Go to YZ School
How is a score kept in a game?

How is a score kept in a game?

www.yzokul.com.tr

  • Category AI Resources
  • Format PDF
  • Size 7.1 MB
  • Added 01.11.2026
  • Views 1

This book answers the question of how a score is kept in a game. It follows a clear path for complete beginners: the score is stored in a variable, a number that the game remembers. When the player does something, like collecting a star, the game increases the variable. The display on the screen is then updated to show the new value. Finally, if the score must stay after the game closes, the book explains that a separate save step to a file or database is needed.

Read the Book

If the PDF does not appear, open it in a new tab.

A Chapter from the Book

How is a score kept in a game? www.yzokul.com.tr

A game must remember how well you are doing, and it does this by keeping a score. The score is a number that the game stores in a variable and changes as you play. For example, when you collect a star, the game adds points to your score. The game then shows the new score on the screen so you can see it. 1

A variable is a named place where a game keeps a value, like a labeled box that holds one number at a time. You can think of it as a container with a name written on it. The game can look inside the box to read the number or put a new number in. For example, a variable named score can hold the number 0 or 10. 2

The score itself is just a variable that holds a number. In a game, you might see something like score = 0, which means the variable named score currently holds the number zero. The game remembers this number while it is running. Every time you do something, the game can change the number inside this variable. 3

Most games start the score at zero when a new game begins. Setting the score variable to zero gives a clean starting point for every player. For example, before the first level starts, the game sets score = 0. This way, no points from a previous game are left over, and everyone begins fresh. 4

When you play, you do things like collect a star or hit a target. These actions are what change the score. For example, you move your character to a star and touch it. The game notices this action and decides that the score should go up. The action is the trigger for changing the score variable. 5

Collecting a star usually adds a number to the score. The game takes the current score, adds ten to it, and stores the new total back in the variable. For example, if the score was 20, it becomes 30. The game replaces the old value with the new one, so the variable now holds 30. 6

Some actions can decrease the score instead of increasing it. For example, if you hit an obstacle, the game might subtract five points. The game takes the current score, subtracts five, and stores the smaller value. If the score was 30, it becomes 25. The variable now holds the new, lower number. 7

After adding or subtracting, the score variable holds a new number. This new number is the current score at that moment. For example, after collecting a star, the score might change from 30 to 40. The game keeps this updated number in the variable. The old number is gone, replaced by the new one. 8

The game shows the score on the screen as text so you can see it. The display reads the current value from the score variable. For example, the screen might show the words Score: 40. The number 40 comes directly from the variable. The display does not calculate anything; it just shows what the variable holds. 9

When the score changes, the on-screen display must be updated too. If the game does not update the display, the screen would keep showing an old number. For example, if the score changes from 40 to 50 but the display is not refreshed, you would still see Score: 40. The fix is to update the display after every change. 10

The score variable keeps the score correct for the whole game session. Every action that changes the score updates the same variable. For example, collecting ten stars in a row adds ten times the points to the same score variable. The game does not need a new variable for each star; it just keeps adding to the one it has. 11

A variable lives in the computer's memory while the game is running. When the game closes, that memory is cleared, and the score variable is lost. Without extra steps, the score disappears and is not there the next time you play. For example, closing the game and reopening it would show a score of zero again. 12

To keep the score after closing the game, the game must save it to a file. This is a separate saving step that happens in addition to changing the variable. For example, the game can write the score value into a small file on the device. When the game starts again, it reads the file and restores the score. 13

A database is another place to save the score. The game writes the score value into the database so it can be read later. For example, an online game might store your score on a server so you can see it from another device. The database keeps the value safe even after the game closes. 14

A common mistake is changing the score variable but forgetting to update the screen. The game's internal score is correct, but the player still sees the old number. For example, the variable says 50 but the screen shows 40. The fix is to refresh the display every time the score changes, so the screen matches the variable. 15

The score lives in a variable, a named place that holds a number. Player actions like collecting a star add to or subtract from that number. The game shows the current value on the screen and updates the display when it changes. To keep the score after the game closes, the game must save it to a file or database.

This section is a preview taken from the book (about 943 words). To continue, read the book or download the PDF.

Book Details

Book
How is a score kept in a game?
Author
www.yzokul.com.tr
Category
AI Resources
Language
English
Format
PDF · 7.1 MB
Pages
18
Words
about 944
Published
kaynak.yzokul.com.tr · 01.11.2026
Access
Free to read and download; for personal use only, all rights belong to the author.

Frequently Asked Questions

Is the PDF of How is a score kept in a game? free?

Yes. How is a score kept in a game? can be read and downloaded for free on this site; no sign-up or payment is required.

How many pages is How is a score kept in a game??

How is a score kept in a game? has 18 pages and about 944 words.

Which devices can I read How is a score kept in a game? on?

It is a PDF; you can read it in your browser on a phone, tablet or computer, or download it and open it offline.

Who is the author of How is a score kept in a game??

How is a score kept in a game? was written by www.yzokul.com.tr; it is listed in the AI Resources category.