G
Gillen82
Guest
I'm back again looking your kind help...
I am playing about with a surface which will create blood when enemies are shot, which (sort of) works.
The problem I am having is that the "blood" disappears while still in the view. Attached images will show what I mean.
Here is the code that I have used
CREATE SURFACE
Create Event
Draw Event
OBJECT BLOOD
Create Event
Step Event
SCRIPT FOR BLOOD
As usual, I appreciate giving up your precious time, both to read the post and to respond. If any other info is needed, I will be happy to post.
I am playing about with a surface which will create blood when enemies are shot, which (sort of) works.
The problem I am having is that the "blood" disappears while still in the view. Attached images will show what I mean.
Here is the code that I have used
CREATE SURFACE
Create Event
Code:
//Create surface
surf_blood = surface_create(room_width, room_height);
Code:
///Draw the Surface
if(!surface_exists( surf_blood ) )
{
surf_blood = surface_create(room_width, room_height)
}
else
{
draw_surface(surf_blood, 0, 0);
}
OBJECT BLOOD
Create Event
Code:
///Init Blood
direction = random(359);
speed = random_range(10,30);
friction = random_range(speed/20, speed/40);
shrink = random_range(0.2, 0.7);
Code:
//Shrink Blood
image_xscale -= shrink;
image_yscale = image_xscale;
//Fade Overtime
if(speed > 0)
{
image_alpha -= 0.1;
}
//Draw to Surface
if( instance_exists( part_blood ) )
{
surface_set_target( part_blood.surf_blood );
draw_sprite_ext( spr_blood, 0, x, y, image_xscale, image_yscale, 0, c_white, image_alpha );
surface_reset_target();
}
//Destroy the object
if( image_xscale <= 0 )
{
instance_destroy();
}
SCRIPT FOR BLOOD
Code:
//Create blood on floor
spawn = random_range(10,30);
for( i = 0; i < spawn; i++ )
{
instance_create( x+random_range(-16,16), y+random_range(-16,16), obj_blood );
}
As usual, I appreciate giving up your precious time, both to read the post and to respond. If any other info is needed, I will be happy to post.