Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [SOLVED] When i try to re-create the sprite it just don't work.

Author
Message
GOTO HelloWorld!
11
Years of Service
User Offline
Joined: 21st Oct 2013
Location: Skyrim,...and lost in it!
Posted: 14th May 2022 00:09 Edited at: 14th May 2022 00:33
Hello! i am trying to save memory by deleting sprite and image, but doing so bring a problem. The Sprite & Image refuse to be re-created once deleted. if my player click to see the tutorial map a second time, nothing show up. Anyone got the same problem?

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 14th May 2022 02:44 Edited at: 14th May 2022 02:46
Try adding SetSpriteVisible(8, 1)
If that fails also change SetSpriteDepth(8, 8) to SetSpriteDepth(8, 0)
Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 14th May 2022 03:04 Edited at: 14th May 2022 03:07
This post has been marked by the post author as the answer.
You will have to tailor it to your needs but this works.

GOTO HelloWorld!
11
Years of Service
User Offline
Joined: 21st Oct 2013
Location: Skyrim,...and lost in it!
Posted: 14th May 2022 03:17 Edited at: 14th May 2022 03:20
Thanks for trying to help Steve Ancell. I tried it but it didn't solve the problem. Now, i know this will sound totally weird, but i actually did solve the problem...but i have no clue why it now works. Here is what i did...you will not believe it. I simply added a variable that count between my menu choices and the end of the loop! Look for the line WAITING=WAITING+1 i didn't even check for a result, it just work perfect now!
it seems to give the time to the program to actually delete the sprite and image before returning or i don't know why, but it now works perfectly. I can't imagine how many people run into this and never figure out why their program didn't work when the logic is good.

GOTO HelloWorld!
11
Years of Service
User Offline
Joined: 21st Oct 2013
Location: Skyrim,...and lost in it!
Posted: 14th May 2022 03:24
Sorry Steve! We post mostly at the same time. Yes your code actually works! But my new code also works! I will keep your code in mind though as i might run into something similar so it gives me another way to solve it Thanks!
GOTO HelloWorld!
11
Years of Service
User Offline
Joined: 21st Oct 2013
Location: Skyrim,...and lost in it!
Posted: 14th May 2022 03:33
Here is the link if you want to see it in action. Thanks again!

https://drive.google.com/file/d/1sE9OHjcvD3hlGXyuMFxNWTmMxsxSmeT0/view?usp=sharing
GOTO HelloWorld!
11
Years of Service
User Offline
Joined: 21st Oct 2013
Location: Skyrim,...and lost in it!
Posted: 14th May 2022 03:40
I still give you the credit for the answer! But maybe that should be brought to be studied as this is a weird behavior that may happen to other people without having an easy explanation...

Login to post a reply

Server time is: 2024-11-23 08:23:31
Your offset time is: 2024-11-23 08:23:31