Jump to content
  • entries
    5,048
  • comments
    2,756
  • views
    1,822,568

Three foods


atari2600land

339 views

So I did a bit of coding before I went to sleep. I got three foods in the game now. But I discovered a couple of bugs.
#1 - when the score reached past 255, it went crazy. I discovered this was due to me trying to add different types of variables together. Which I don't understand why it wouldn't go crazy before it reached 255. So I changed food speed variables from a char to an int (which the score was) and the problem went away.

I went to sleep and woke up. I'm trying to switch my life around so I'm awake during the day and asleep at night. I went to sleep at noon and woke up a couple of times and woke up for good at about 2am. It was at 2am when I noticed the other bug:
#2 - right after the food got eaten but before a new one was on screen, the new food type was displayed at the mouth for a split second. I think changing some code around fixed that problem. The third food seems to be random enough.

I was noticing that the black pickles weren't showing up as much. So I made the "random" number be between 0-10 and have the pickle be between 8-10. The pickle shows up more often now which is good.

The way I do random numbers is this:

unsigned char *ptr_div_reg = 0xFF04;unsigned char random_thing = *(ptr_div_reg);    



I don't know what this does, but it works pretty good, so I'm using it. I make it so:

food3type = random_thing % 10;



returns a number between 0-10. I was worried that it wouldn't be random enough for three items but it seems to be working well enough.
blogentry-9475-0-16537800-1546688816.png

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   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...