refatones.blogg.se

Gamemaker studio 2 surfaces
Gamemaker studio 2 surfaces




gamemaker studio 2 surfaces

Anything we draw at this point will be deleted, we could draw as many things as we liked here however I’m just going to draw a circle where the mouse is.ĭraw_set_blend_mode(bm_normal) and surface_reset_target() – These just set GameMaker back to how you normally do things, you have to set these back because GameMaker will not let you continue and will crash if you don’t set these back.

gamemaker studio 2 surfaces

There are other blend modes you can use however we will be using bm_subtract which rather than drawing each pixel will remove the colour value instead of adding one in.Īt this point it is worth just highlighting that we have told GameMaker to draw onto the top surface rather than the screen AND everything it draws should be deleted from the image. I now draw the whole top sprite onto the screen using the standard draw_sprite().ĭraw_set_blend_mode(bm_subtract) - Here I need to remove a hole from the top image like I had an eraser, we do this with draw_set_blend_mode(bm_subtract). Surface_set_target() – Normally in GameMaker when you say draw_text() or draw_sprite() you just expect them to be drawn to the screen, well using surface_set_target() we can actually tell GameMaker to draw onto a surface we have made rather than the screen. I will point out here that you always need to check if a surface exists before you call it because they are volatile and can be removed from the graphics memory. Let’s talk about how we can do this.įirst we have to create a surface, if you don’t know what a surface is in GameMaker its basically an image that we can draw onto just like we normally draw onto the screen, we can then draw this surface onto the screen just like we would a sprite. The top image has a hole taken out of it that allows you to see through it and to the image below. I have two images that are the same size as the room, the top image and the bottom image.






Gamemaker studio 2 surfaces