I get some trouble when adding some music to the game, I copy + paste the code from sprite example, also copy + paste same vgm music etc. then my game only runs on fusion emulator with music and stops to work on gens (black screen). when I comment the code from the music "//SND_startPlay_XGM(musica);" the game works fine on both emulators. any solution?
The code of the game is the same one I added a link on the last post, I just added the line
"SND_startPlay_XGM(musica);"
where musica refers to the same vgm music from the sprite example.
Gens emulates better than fusion, as the game with music did not play on my mega drive. Withouth music it played.
EDIT: problem with the music solved. I added sound fx, the jump sound, then the game worked 100% and the music played on gens emulator. Later I will test again on mega drive.
also I wanna know if it is possible to destroy a sprite, then create another using the free space that it left on vram tiles and change the animation.
the order I did the commands
1- sprites[1] = SPR_addSprite(&inimigo1, fix32ToInt(inimigoX[0]), fix32ToInt(inimigoY[0]), TILE_ATTR(PAL3, TRUE, FALSE, FALSE)); //add a sprite with animation inimigo1, ok
2- SPR_setVRAMTileIndex(sprites[1],200); //uses the tile index 200, ok
to test the way to destroy the sprite and put another with other animation I press button A, then these commands are executed:
3- SPR_setNeverVisible(sprites[1],TRUE); //truly hides the sprite
4- sprites[1] = SPR_addSprite(&inimigo2, fix32ToInt(inimigoX[0]), fix32ToInt(inimigoY[0]), TILE_ATTR(PAL3, TRUE, FALSE, FALSE)); //add a sprite with a new animation inimigo2, ok
5- SPR_setVRAMTileIndex(sprites[1],200); //goes to the same tile index vram position=200, ok
but if I keep pressing A button, I thought it will clean/delete with never visible, but then the game crashes.
what could I do to avoid the game crashes?