# Blue Screen of Death

## Recommended Posts

I ask you guys a lot of questions, and I am grateful for all of your help. Sometimes when I'm giving the game I'm working on a test run, after playing around for a bit, the screen turns blue and it flickers a bunch with random chunks of black lines flying everywhere. I was just wondering what this means, am I using up to much RAM? Or something else? Thanks.

##### Share on other sites

Do you want to keep the code a secret or can you post it? After what is wrong is figured out, I'll put the problem and the fix for it on the bB page in the troubleshooting section.

##### Share on other sites

Ok, here it is. The unfinished first project. It still has a lot of weird bugs I need to work out, no enemies, and no scoring either.

##### Share on other sites

This has nothing to do with your problem, but before I look deeper, you have this:

``` temp1 = temp2 + rand
temp2 = (rand/16) + (rand&15) + (rand/4) + (rand&31) + (rand&15) + (rand/64) + 12```

It seems temp2 has no value on the first line. Did you mean to have "temp1 = temp2 + rand" after "temp2 = (rand/16) . . ." like this:

```   temp2 = (rand/16) + (rand&15) + (rand/4) + (rand&31) + (rand&15) + (rand/64) + 12
temp1 = temp2 + rand```

##### Share on other sites

Thanks, that whole random thing was quite confusing to me.

##### Share on other sites

What number range are you looking for with your random number?

1-255

##### Share on other sites

Another thing I see is "if ballx > 240 then goto random". That's too big of a number. You might end up using something like 155. And " if ballx < 0 then goto random" should probably be something like 5 instead of 0.

You can find the numbers you need by running this program:

Seems like you're also using the same code over and over when you don't have to. If Karl G doesn't post something, I'll see what I can do.

##### Share on other sites

@Random Terrain I'll let you take a crack at it - I haven't had a chance to dig into the code.

##### Share on other sites

After playing with it for a while, I noticed that the numbers used in the if-thens didn't catch all of the possibilities, so I fixed the problem and made other changes:

Every random screen also has _BK_Color for the background color and _PF_Color for the playfield color. You can change those values to whatever you want and that will change the colors in the main loop.

##### Share on other sites

IIRC to keep in mind the temp variables are obliterated everytime you call drawscreen (not 100% sure about the standard kernels) as sometimes it depends on what temp variables are used. For single frame calculations i find them useful however personally for random number generation or values i want to read id rather store that value so i can read it and or increment it every frame. I look at it like Russian roulette, it's all about when you pull that trigger it's luck of the draw as to what it lands on.

In some cases rand doesn't even need to be used especially when it's not a timed event. rand can be cycle intensive and sometimes the least amount of calculations can make for the better experience. Keep at it and experiment, you will stumble onto what you're looking for 👍

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.