Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Cannot allocate item. Out of id numbers (max 1000)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
programmer_needs_help




PostPosted: 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 Sad
Sponsor
Sponsor
Sponsor
sponsor
programmer_needs_help




PostPosted: 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?
Insectoid




PostPosted: 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.
programmer_needs_help




PostPosted: 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!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: