Im not sure if GM Studio suports surfaces but if it does then try this:
// CREAT EVENT
surfaceRectangle = surface_create(width, height)
// The following part can also be put in some other event if you like to update the size of the rectangle.
surface_set_target(surfaceRectangle)
// Draw the rectangle.
draw_set_color(c_red)
draw_rectangle(0, 0, width, height, 0)
// Remove a circle from the center of the rectangle.
draw_set_color(c_white)
draw_set_blend_mode(bm_subtract)
draw_ellipsoid(0, 0, width, height)
draw_set_blend_mode(bm_normal)
surface_reset_target()
// DRAW EVENT
draw_surface(surfaceRectangle, x, y)
What this does is that it will:
1. Draw a rectangle to a surface (a surface is kinda like a sprite which can be modified in real time).
2. Then it changes the blend mode so that when you draw the circle it will remove pixels from the surface rather then draw pixels.
3. Simply draw the surface anywhere on the screen.
Surfaces are really usefull in a lot of situiations such as light and shadow effects.
This is an example of what you can achieve:
Notice that the water is wavey and it's actually animated in real time, yet another example of what kind of power surfaces possess.
Edited by filulilus, 10 April 2012 - 06:57 AM.