Game Dev From Zero · Episode 2

Variables playground

Everything this little game knows lives in a variable: a box in memory with a name and a value. You can see every box under RAM. Change them by typing a line of code like set speed to 4.

The game arrows / WASD to move, collect souls

The hearts, the souls counter, the name and the speed
all come straight from the boxes in RAM.

Your code one line at a time, then Enter

RAM every variable, live

The game's code it reads your boxes


    

Things to try

  1. set speed to 4, then walk around. Then set speed to 0.
  2. set player_name to "Nour" with your own name. Then try it without the quotes and read what happens. (Name versus value!)
  3. set lives to lives + 1 a few times. Read the right side, work it out, store it.
  4. set is_sleeping to true. Now try to move.
  5. Make your own box: set my_cat to "Mishmish". The game doesn't use it, but it's in memory now.
  6. Tick "show the bits", then set souls to 255 and set souls to 256. Why did it need more bits?