Computer Science Canada Cannot allocate item. Out of id numbers (max 1000) |
Author: | programmer_needs_help [ Mon Jun 05, 2017 4:32 pm ] |
Post subject: | Cannot allocate item. Out of id numbers (max 1000) |
This code wont run. I'm trying to change the "playerSprite" into another picture under certain conditions, but turing crashes after a while. I've seen posts on pic.free and its not working. Here's a section of the code: % Player Positioning Process Toward Left Side process playerPositionLeft loop if playerXValue > enemyOneXValue and playerYValue = ground then Sprite.Hide (playerSprite) Pic.Free (player) player := Pic.FileNew ("playerBlazeFlipped.bmp") player := Pic.Scale (player, 152, 165) playerSprite := Sprite.New (player) Sprite.Show (playerSprite) Sprite.SetPosition (playerSprite, playerXValue, playerYValue, true) delay (20) View.Update end if end loop end playerPositionLeft % Player Positioning Process Toward Right Side process playerPositionRight loop if playerXValue < enemyOneXValue and playerYValue = ground then Sprite.Hide (playerSprite) Pic.Free (player) player := Pic.FileNew ("playerBlaze.bmp") player := Pic.Scale (player, 152, 165) playerSprite := Sprite.New (player) Sprite.Show (playerSprite) Sprite.SetPosition (playerSprite, playerXValue, playerYValue, true) delay (20) View.Update end if end loop end playerPositionRight fork playerPositionLeft fork playerPositionRight pls help ![]() |
Author: | programmer_needs_help [ Mon Jun 05, 2017 4:35 pm ] |
Post subject: | RE:Cannot allocate item. Out of id numbers (max 1000) |
am i using pic.free in the right location or should i move it elsewhere? |
Author: | Insectoid [ Mon Jun 05, 2017 8:24 pm ] |
Post subject: | RE:Cannot allocate item. Out of id numbers (max 1000) |
In this case you are running out of sprites, not pics. You need to call Sprite.Free before Sprite.New. However, you can use Sprite.ChangePic to change the sprite's image without having to use free or new. I also recommend you use procedures instead of processes. You'll probably run into all kinds of strange bugs that are otherwise Impossible to fix if you don't. |
Author: | programmer_needs_help [ Mon Jun 05, 2017 11:13 pm ] |
Post subject: | RE:Cannot allocate item. Out of id numbers (max 1000) |
I never thought someone would respond about turing. Thanks so much I'll try it! This really means a lot it's for my final! |