【GAMEMAKER】 Pixelate Image

Information about object: obj_image
Sprite: spr_image
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.draw = 0
Draw Event:
execute code:

draw_self();

if(global.draw == 1){
global.cell=0;//set a counter to keep track of how many cells
for (i = 0; i < sprite_get_width(spr_image); i += 10)//create a loop 10 pixels a time
{
for (j = 0; j  < sprite_get_height(spr_image); j += 10)
{

col=draw_getpixel(i,j);//get colour at position
global.data[global.cell,0]=col;//write colour to array
global.data[global.cell,1]=i;//write x cord
global.data[global.cell,2]=j;//write y cord
global.cell++;//increase counter
}
}
global.draw = 0    
room_goto(room_show_image);
}

Information about object: obj_show
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Draw Event:
execute code:

for (i = 0; i < global.cell;  i+=1;)//create loop
{

draw_set_colour(global.data[i,0]);//get colour from position in array
x_pos=global.data[i,1];//get x cords
y_pos=global.data[i,2];//get y cords
draw_rectangle(x_pos,y_pos,x_pos+10,y_pos+10,false);//draw rectangle
}

Information about object: obj_draw
Sprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

global.draw = 0
Mouse Event for Left Released:
execute code:

global.draw = 1

No comments:

When Bad People Make Good Art

I offer six guidelines on cancel culture ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏...

Contact Form

Name

Email *

Message *