Computer Science Canada Orbital Game Help |
Author: | Luminosity [ Sun Apr 17, 2011 5:54 pm ] | ||
Post subject: | Orbital Game Help | ||
What is it you are trying to achieve? Trying to make a game like Orbital on the Ipod Touch. What is the problem you are having? So far the project is going well, the program runs fine for about 3-5 mins but then will crash and give me an Illegal Picture ID error. I am not using any picture files for the project yet, but I only used the Pic.New function to be able to rotate an object. I think the problem may be caused by the Pic.Free function, but I do not know how to fix this. Describe what you have tried to solve this problem The only way I got it to work again is by closing the entire Turing program, but it will still crash again after the 3-5 mins. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) My game code so far, the shooting is not implemented yet.
Please specify what version of Turing you are using 4.1.1 |
Author: | DemonWasp [ Sun Apr 17, 2011 7:33 pm ] |
Post subject: | RE:Orbital Game Help |
You allocate a new picture every time you loop (with Pic.Rotate, which makes a new picture). You only deallocate that picture with Pic.Free if the player is pressing Q. You should rotate the image before you start play, and store the rotated versions of the image in an array of ints. Alternately, you can make sure that a Pic.New / Pic.FileNew / Pic.Rotate is ALWAYS matched with a Pic.Free. |
Author: | Raknarg [ Sun Apr 17, 2011 8:05 pm ] |
Post subject: | RE:Orbital Game Help |
Or you could simplify this and learn Trig ![]() |
Author: | Luminosity [ Sun Apr 17, 2011 9:33 pm ] |
Post subject: | Re: Orbital Game Help |
@DemonWasp thanks for the suggestions, but I tried both and it didn't work out. The arrays didn't help, it still has the same problem. By matching up the Pic.Free, the program still doesn't work and it gives me an error saying Pic was freed. @Raknarg could you tell me how to simplify this? ![]() |
Author: | Tony [ Sun Apr 17, 2011 9:44 pm ] |
Post subject: | RE:Orbital Game Help |
Arrays help greatly, but that assumes that you'll be using less than 1000 pictures. Quote: By matching up the Pic.Free, the program still doesn't work and it gives me an error saying Pic was freed. This means that new and free were not matched up correctly (as you are letting go of a picture, and then trying to use it after). |
Author: | Raknarg [ Tue Apr 19, 2011 6:53 pm ] | ||
Post subject: | RE:Orbital Game Help | ||
If you really wanted to use trig, you would use this:
However, this is kindof bulky and not quite as effective. If you want a better effect, just use Draw.ThickLine |