Computer Science Canada Fly Swatter Mini Game |
Author: | andrew. [ Sun May 11, 2008 10:27 am ] | ||
Post subject: | Fly Swatter Mini Game | ||
Hi guys, I'm having a bit of trouble with my fly swatter mini game. I have the code (which I will clean up, refine, and make it prettier later) but I just can't figure out how kep the the glass looking like it is cracked. Look at my code, you'll see that when you click somewhere, it draws a crack, but I can't think of anyway to keep the crack there. Any help?
Thanks a lot, andrew. |
Author: | Dan [ Sun May 11, 2008 8:00 pm ] |
Post subject: | RE:Fly Swatter Mini Game |
It's hard to debug the code with out the pictuers but my guses is that you are clearing the screen and it clears away the images of the cracks. What you will have to do is keep track of the where the cracks are and redraw them all every loop. Or you could store a pic of the background befor anything is drawn above it in memeory and redraw that affter the screen is cleared. |
Author: | andrew. [ Mon May 12, 2008 6:05 pm ] |
Post subject: | RE:Fly Swatter Mini Game |
I've been trying to firgure out a way to have it remember where the cracks were. I'm pretty sure the code was right but the number stored in the array was turning into 0 each loop. Anyways, that's a good idea Dan, I'll just get the screen, draw the crack and save the screen. The only problem is the flies. It will save the flies too. Hmm.... |
Author: | andrew. [ Mon May 12, 2008 6:17 pm ] |
Post subject: | RE:Fly Swatter Mini Game |
Question: Can you draw the same picture more than once at a time? I got it to work, but now it replaces the old one with the new one. EDIT:: Fixed it with a for loop. |