Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////scr_bullet_explode(chunk size);
- chunk = argument0; //this is how big your chunks will be in pixels
- ww = sprite_get_width(sprite_index); //we need to know how wide
- hh = sprite_get_height(sprite_index); //and how tall our sprite is
- for (i = 0; i < ww; i += chunk)
- { //we loop 4 pixel at a time all the way across
- for (j = 0; j < hh; j += chunk)
- { //while picking all the vertical pixels in each column
- particle = instance_create(x+i, y+j, obj_particle); //we create a particle relative to the object, offset by the proper amount
- particle.spr = sprite_index; //we need to tell the particle which sprite to draw. in this case, it's drawing the sprite of the object that's creating it
- particle.size = chunk;
- particle.xx = i; //we'll need the particles to have these values so they can draw the right part of the sprite
- particle.yy = j;
- }
- }
- OBJECT: obj_particle
- CREATE EVENT
- direction = random(360); //this points the particle in a random direction.
- speed = random_range(4,8); //this is how fast the particles will move
- alarm[0] = random_range(30,60); //this will determine how long a particle exists before destroying it
- motion_set(direction,speed); //this tells the particle to start moving
- ALARM EVENT
- instance_destroy();
- DRAW EVENT
- draw_sprite_part(spr,-1,xx,yy,size,size,x,y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement