Advertisement
gravvy

Untitled

Jan 17th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. ////scr_bullet_explode(chunk size);
  2.  
  3. chunk = argument0; //this is how big your chunks will be in pixels
  4.  
  5. ww = sprite_get_width(sprite_index); //we need to know how wide
  6. hh = sprite_get_height(sprite_index); //and how tall our sprite is
  7.  
  8. for (i = 0; i < ww; i += chunk)
  9. { //we loop 4 pixel at a time all the way across
  10. for (j = 0; j < hh; j += chunk)
  11. { //while picking all the vertical pixels in each column
  12. particle = instance_create(x+i, y+j, obj_particle); //we create a particle relative to the object, offset by the proper amount
  13. 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
  14. particle.size = chunk;
  15. particle.xx = i; //we'll need the particles to have these values so they can draw the right part of the sprite
  16. particle.yy = j;
  17. }
  18. }
  19.  
  20.  
  21.  
  22.  
  23. OBJECT: obj_particle
  24.  
  25.  
  26. CREATE EVENT
  27. direction = random(360); //this points the particle in a random direction.
  28. speed = random_range(4,8); //this is how fast the particles will move
  29. alarm[0] = random_range(30,60); //this will determine how long a particle exists before destroying it
  30. motion_set(direction,speed); //this tells the particle to start moving
  31.  
  32. ALARM EVENT
  33. instance_destroy();
  34.  
  35. DRAW EVENT
  36. draw_sprite_part(spr,-1,xx,yy,size,size,x,y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement