///Mirror
// draw sprite mirror
draw_sprite(sprite_index,0,x,y);
// mirror position
_xx = x;
_yy = y;
_surf = surface_create(300,200); // mirror size
surface_set_target(_surf);
draw_clear_alpha(c_black,0);
draw_sprite_ext(obj_hero.sprite_index,obj_hero.image_index,obj_hero.x - _xx ,obj_hero.y - _yy - 70,obj_hero.image_xscale,obj_hero.image_yscale,0,image_blend,.5)
// we draw a bullet on the surface
var _xx1 = x
var _yy1 = y
for (i = 0; i < instance_number(obj_bullet); i += 1) {
obj = instance_find(obj_bullet, i);
draw_sprite(spr_bullet, 0, obj.x - _xx1, obj.y - _yy1 );
}
surface_reset_target();
draw_surface(_surf,_xx,_yy); // draw mirror
surface_free(_surf) // clean mirror
//we draw a sprite of an object that is not in the editor room
if (instance_exists(obj_background_surface)) {
spriteToDraw = obj_background_surface.sprite_index;
} else {
targetObject = instance_create(0,0, obj_background_surface);
spriteToDraw = targetObject.sprite_index;
with (targetObject) {
instance_destroy();
}
}
//we draw a background on the surface
var draw = 0;
with (obj_hero){
if distance_to_object(obj_mirror) <= 20 {
draw = 1;
}
}
if draw {
draw_sprite_ext(spriteToDraw,0,x ,300,image_xscale,image_yscale,0,image_blend,.5)
}