Hey there,
I've a strange behavor in my code:
My mouse (pointer is invisible) have a sprite to show the position of the mousepointer - the pixel is for collisionchecks:
Function GlobalLoadMouseSprites()
GlobalMouseCursor = CreateSprite(LoadImage("graphics\mouse.png"))
GlobalMouseCursorPixel = CreateSprite(LoadImage("graphics\mousepixel.png"))
SetSpriteColorAlpha(GlobalMouseCursor, 255)
SetSpriteDepth(GlobalMouseCursor, 0)
EndFunction
This sprite is loaded at the start of the game and is global. Later in my code I declare an integer to get another sprite for the background:
BackgroundSprite as integer
BackgroundSprite = CreateSprite(LoadImage("graphics\nextplayer\scroll.png"))
SetSpritePosition(BackgroundSprite, GetVirtualWidth() / 2 - GetSpriteWidth(BackgroundSprite) / 2, GetVirtualHeight() / 2 - GetSpriteHeight(BackgroundSprite) / 2)
In a loop I refresh the position of the mousesprite:
do
SetSpritePosition(GlobalMouseCursorPixel, GetRawMouseX(), GetRawMouseY())
SetSpritePosition(GlobalMouseCursor, GetRawMouseX(), GetRawMouseY())
Sync()
loop
When I test this code and run the game, the backgroundSprite ist now my Mousesprite. I debugged this and saw, that both, the sprite for the mouse and the backgroundsprite have the same ID. Are there some limitations or I do something wrong to create sprites?