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.
0 Comments
Recommended Comments
There are no comments to display.