Weird "Illegal Picture ID Number '0'" Error
Author |
Message |
Nathan4102
|
Posted: Mon Sep 16, 2013 8:01 pm Post subject: Weird "Illegal Picture ID Number '0'" Error |
|
|
I'm just screwing around with this game I've been working on lately, and I've come across an odd bug. For some reason, if I run around in my game for a while, maybe 60 seconds or so, an "Illegal Picture ID Number '0'" error pops up on line 89. If you don't want to go to the project thread, its this procedure:
Turing: | procedure animatedMotion (dir : string, justTurn : boolean)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*Procedure Desc.: This procedure handles the
animation when walking. */
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var animatedPic : int
var a, b, c, d : int
drawScreen
a := 0
b := 0
c := 0
d := 0
animatedPic := Pic.New (0, 0, 600, 600)
case dir of
label "up" :
a := 1
label "down" :
b := 1
label "left" :
c := 1
label "right" :
d := 1
end case
for i : 1 .. 40 by 4
Pic.Draw (animatedPic, (c * - 40) + (d * 40) + (c * i ) + (d * -i ), (b * - 40) + (a * 40) + (b * i ) + (a * -i ), picCopy) %ERROR HAPPENS HERE
Pic.Draw (pic (indexArray (dir )), 280, 280, picMerge) %Draw the character
Pic.Draw (pic (23), 0, 0, picMerge)
View.Update
end for
end animatedMotion |
Any idea what could be throwing this error? The only possibility I've come up with is that maybe I'm filling up the memory by constantly creating new images. I'm not sure...
Thanks!
Nathan |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Mon Sep 16, 2013 8:05 pm Post subject: RE:Weird "Illegal Picture ID Number \'0\'" Error |
|
|
I'm guessing it's that you're filling up too much memory. I'm pretty sure Turing can only handle about 1000 pictures before crashing.
Look up Pic.Free. It'll free up space so it doesn't crash. |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Sep 16, 2013 8:38 pm Post subject: RE:Weird "Illegal Picture ID Number \'0\'" Error |
|
|
That error code means your picture failed to load. As Raknarg said, you can only have 1000 images loaded at a time. A walking animation should require only 5 or 6 images to be loaded at once. There's no reason to ever reach Turing's limit unless you have lots of multi-part sprites or rotations. |
|
|
|
|
![](images/spacer.gif) |
Nathan4102
|
Posted: Mon Sep 16, 2013 9:02 pm Post subject: RE:Weird "Illegal Picture ID Number \'0\'" Error |
|
|
Instead, I'm taking one picture and sliding it across the screen. The pictures must have been stockpiling instead of overwriting each other every time we move, a Pic.Free fixed it though.
Thanks! |
|
|
|
|
![](images/spacer.gif) |
|
|