PixelChipCode

Paint with Pixels

Oct 18th, 2024 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.96 KB | Source Code | 0 0
  1. //Paint with Pixels by oliver @pixelchipcode
  2.  
  3. // obj_paint_spawner Step Event
  4. if (mouse_check_button(mb_left)) {
  5.     repeat(20) {
  6.         var angle = random(360);
  7.         var radius = random(10);
  8.         var rx = mouse_x + lengthdir_x(radius, angle);
  9.         var ry = mouse_y + lengthdir_y(radius, angle);
  10.         instance_create_layer(rx, ry, "Instances", obj_paint);
  11.     }
  12. }
  13.  
  14. // obj_paint Create Event
  15. y_speed = random(1);
  16. friction = random_range(0.8, 0.99);
  17.  
  18. // obj_paint Step Event
  19. y_speed *= friction;
  20. y += y_speed;
  21. if (y_speed <= 0.01) instance_destroy();
  22. if (surface_exists(obj_surface_paint.canvas_surface)) {
  23.     surface_set_target(obj_surface_paint.canvas_surface);
  24.     draw_self();
  25.     surface_reset_target();
  26. }
  27.  
  28. // obj_surface_paint Create Event
  29. canvas_surface = surface_create(256, 256);
  30.  
  31. // obj_surface_paint Draw Event
  32. if (!surface_exists(canvas_surface)) canvas_surface = surface_create(256, 256);
  33. draw_surface(canvas_surface, 0, 0);
Tags: gameMaker
Advertisement
Add Comment
Please, Sign In to add comment