Hi there again!
I am currently adding a menu scene to my test game and I'm having already trouble, even though I want to add even two more scenes on top of that.
I have the problem that the sprites of the one scene remain in the other scene and are still being depicted.
Calling "Scene_cleanup()" doesn't do anything. Even when I set every sprite of the scene to invisible, they are still being depicted.
So I'm having my "game scene" and my "menu scene". When I changed the scene from "game" to "menu" it actually worked fine. I just had to call GameScene_cleanup() to clear the sprites. But now that I start the game with the menu scene first, the sprites are overlapping when changing back to the "game scene".
The entire script is quite long and probably hard to read, so I tried to include only the parts that I think could be relevant to this problem. And hoping that it's enough to detect the problem:
//Inluding SCENES:
#include "Menuscene.scene"
#include "Pond.scene"
#include "DeadScene.scene"
//loading menu scene and it's elements in the beginning:
Menuscene_setup()
backanimation=LoadAnimation(MenuScene_back,"Menu/back/back0",29)
anemone=LoadAnimation(MenuScene_anemone,"Menu/anemone/anemone0",19)
coral=LoadAnimation(MenuScene_coral,"Menu/coral/coral0",19)
musicmenu=LoadSound("Audio/musicmenu.wav")
PlaySound(musicmenu,100,1)
Play(backanimation,10)
Play(coral,10)
Play(anemone,15)
//DEFINING WHICH SCENE IS RUNNING:
//Menu Variables:
global MENUDEAD=0
global GAME=0
global MENuSTART=0
global MENuWIN=0
MENU=1
//MAIN GAME LOOP:
do
print("is menu on?"+STR(MENU))
if MENU
if GetVirtualButtonPressed(MenuScene_Play)
MENU=0
GAME=1
StopSound(MusicMenu)
SetSpriteVisible(MenuScene_back,0)
SetSpriteVisible(MenuScene_anemone,0)
SetSpriteVisible(MenuScene_coral,0)
Pond_setup()
LoadPond()//loadpond function loads animations and sounds for the game scene
MenuScene_cleanup()
Break()
endif
MenuScene_sync()
Sync()
elseif GAME
print(FoodCount)
print(SizeLevel)
//all the main game function etc. are here
Pond_sync()
Sync()
endif
loop
When I press the virtual "Play" button, the game scene (pond.scene) starts running, but the old sprites remain for some reason.
Thanks for any tips in advance.