• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

bm_subtract not working with sprite created from surface

H

hamid1855

Guest
Ok I have a surface with a bunch of stuff drawn on it in the beginning. The user is able to erase stuff on it using bm_subtract blend mode.

After the user is done erasing stuff, they let go of the mouse and the sprite index of the another object is updated and its sprite index is set to a sprite created from the surface that the user was erasing stuff from.

The problem I am having is that when I use sprite_create_from surface and set it to the object, it doesnt change the parts that the user erased for some reason. I thought bm_subtract actually erases the pixels that were there, then why is the sprite created from the updated surface changing as well?

Thanks in advance.
 
H

hamid1855

Guest
ok i figured out if that i use an eraser that is colored white then it actually erases part of the surface and the sprite from the updated surface is correct, but there is a black part now showing up where the eraser sprite's transparent parts collide with the already drawn surface.
 
H

hamid1855

Guest
Well if anyone cares I figured it out. I made 2 surfaces, one is the visible one that uses the black eraser so that there are no weird graphics when you erase stuff and the other surface is invisible which uses the white eraser to actually update the sprite from surface properly and even though the real erasing surface isn't visible, the game is able to determine if the place is empty or not based on the fact that the sprite has nothing in it (so it cant collide with it if there isnt any pixel there).
 
Top