Advertisement
kurath

Updated Seamless Blocks

Nov 28th, 2017
238
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 1 0
  1. if !surface_exists(surf){
  2. surf=surface_create(room_width,room_height);
  3.  
  4.  
  5. surface_set_target(surf);
  6.  
  7. draw_clear_alpha(c_black,0);
  8. with objBlock
  9. {
  10. var color = other.color
  11. var thickness = other.thickness
  12.  
  13. var a;
  14. for (a = 0; a < image_xscale; a += 0.5)
  15. {
  16. if not (position_meeting(x + a * 32, y - 1, objBlock) or position_meeting(x + (a + 0.5) * 32 - 1, y - 1, objBlock)) // above
  17. {
  18. draw_rectangle_color(x + a * 32,y,x+(a + 0.5) * 32 - 1,y+thickness,color,color,color,color,false);
  19. }
  20. if not (position_meeting(x + a * 32, y +32 * image_yscale, objBlock) or position_meeting(x + (a + 0.5) * 32 - 1, y + 32 * image_yscale, objBlock)) // below
  21. {
  22. draw_rectangle_color(x + a * 32,y + 32 * image_yscale - 1 - thickness,x+(a + 0.5) * 32 - 1,y+32 * image_yscale - 1,color,color,color,color,false);
  23. }
  24. }
  25. for (a = 0; a < image_yscale; a += 0.5)
  26. {
  27. if not (position_meeting(x -1, y + a * 32, objBlock) or position_meeting(x -1, y + (a + 0.5) * 32 - 1, objBlock)) // left
  28. {
  29. draw_rectangle_color(x ,y + a * 32,x+thickness,y+(a + 0.5) * 32 - 1,color,color,color,color,false);
  30. }
  31. if not (position_meeting(x +32 * image_xscale, y + a * 32, objBlock) or position_meeting(x + 32 * image_xscale, y + (a + 0.5) * 32 - 1, objBlock)) // right
  32. {
  33. draw_rectangle_color(x + 32 * image_xscale - 1 - thickness,y + a * 32,x+ 32 * image_xscale - 1,y+(a + 0.5) * 32 - 1,color,color,color,color,false);
  34. }
  35. }
  36.  
  37. }
  38. with objBlock
  39. {
  40. var thickness = other.thickness
  41. var color = other.color
  42.  
  43. var a = 0;
  44. for (a = 0; a < image_xscale; a += 0.5)
  45. {
  46. if not (position_meeting(x + a * 32, y - 1, objBlock) or position_meeting(x + (a + 0.5) * 32 - 1, y - 1, objBlock)) // above
  47. {
  48. if (position_meeting(x+a*32-2,y-2,objBlock) and position_meeting(x+a*32-2,y+2,objBlock))
  49. {
  50. draw_rectangle_color(x+a*32-thickness-1,y,x+a*32-1,y+thickness,color,color,color,color,0);
  51. }
  52. if (position_meeting(x+(a+.5)*32+1,y-1,objBlock) and position_meeting(x+(a+.5)*32+1,y+1,objBlock))
  53. draw_rectangle_color(x+(a+.5)*32,y,x+(a+.5)*32+thickness,y+thickness,color,color,color,color,0);
  54. }
  55. if not (position_meeting(x + a * 32, y +32 * image_yscale, objBlock) or position_meeting(x + (a + 0.5) * 32 - 1, y + 32 * image_yscale, objBlock)) // below
  56. {
  57. if (position_meeting(x+a*32-1,y+1+sprite_height,objBlock) and position_meeting(x+a*32-1,y+sprite_height-1,objBlock))
  58. draw_rectangle_color(x+a*32-thickness-1,y+sprite_height-thickness-1,x+a*32-1,y+sprite_height,color,color,color,color,0);
  59. if (position_meeting(x+(a+.5)*32+1,y+sprite_height-1,objBlock) and position_meeting(x+(a+.5)*32+1,y+sprite_height+1,objBlock))
  60. draw_rectangle_color(x+(a+.5)*32,y+sprite_height-thickness-1,x+(a+.5)*32+thickness,y+sprite_height,color,color,color,color,0);
  61. }
  62. }
  63.  
  64. }
  65.  
  66.  
  67. draw_set_blend_mode_ext(bm_dest_alpha, bm_one);
  68.  
  69. draw_self();
  70. draw_set_blend_mode( bm_normal );
  71.  
  72. surface_reset_target();
  73. }
  74.  
  75.  
  76. if surface_exists(surf)
  77. {
  78. draw_set_alpha(alpha)
  79. draw_surface(surf,0,0);
  80. draw_set_alpha(1);
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement