I have one Sprite and two Image in my project
Sprite is 100 high by 100 wide
imageSource = new Image (100, 100) imageTarget = new Image (100, 100)
Copies the Sprite to imageSource
imageSource.drawSprite (nameSprite, 0, 0, 100, 100)
When I want to copy a Sprite to the screen or to an Image object, it works. screen.drawSpritePart and screen.drawImagePart - work properly. If I copy the next parts of Sprite in the loop, I will finally see the entire Sprite on the screen. If I am looping over the next parts of Image, I will finally see the entire Image on the screen.
ImageTarge.drawSpritePart - Works fine. If I am copying the next parts of Sprite to Image in the loop, when I copy ImageTarget to the screen, I will see the entire Sprite.
ImageTarget.drawImagePart function - not working correctly. When I loop to copy successive parts of another Image, when I copy ImageTarget to the screen, I will see the reduced ImageSource duplicated as many times as I copied it in the loop. If you uncomment line 18, you will see where they should be copied and what size they should be.
Sample code - https://microstudio.dev/i/Loginus/jam3223/
If possible, please fix this error very quickly - because on drawSpritePart I based my idea for a game in 'GAME JAM 3'. Sprites can only be 1024 by 1024, so I put the larger ones into the Assets tab and import them via drawImagePart.
In Firefox 104, I noticed that when copying parts of the Image object (screen.drawImagePart function) and Sprite (screen.drawSpritePart) to the screen, there is a small gap between successive parts. This break is not present when I copy Sprite to Image.