Sprite: spr_terrain
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: //set up w = sprite_width; h = sprite_height; //create surface and add sprite surface = surface_create(w,h); surface_set_target(surface); draw_sprite(spr_terrain,-1,0,0); surface_reset_target(); //save surface as spr spr=sprite_create_from_surface(surface,0,0,w,h,true,true,0,0); sprite_index=spr;
Step Event:
execute code: //manage suface if !surface_exists(surface) { surface = surface_create(w,h); surface_set_target(surface); draw_sprite(spr,-1,0,0); surface_reset_target(); } //create a bomb on mouse press if mouse_check_button_pressed(mb_left) instance_create(mouse_x,mouse_y,obj_bomb);
Collision Event with object obj_bomb:
execute code: //set surface surface_set_target(surface); draw_set_color(c_white); draw_circle(other.x-x,other.y-y,32,false); //reset surface_reset_target(); //delete the sprite sprite_delete(spr); spr=sprite_create_from_surface(surface,0,0,w,h,1,1,0,0); sprite_index=spr; with other instance_destroy();//destroy bomb
Other Event: Room End:
execute code: //clear memory surface_free(surface);
Information about object: obj_bombSprite: spr_bom Solid: false Visible: true
No comments:
Post a Comment