【GAMEMAKER】 Save colour to INI

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

ini_open("colours.ini");//open file
save = ini_read_real("colours","colour",0)
ini_close();//close ini
show_debug_message(save);
if(save  == 0){
my_colour=c_black;
}else{
my_colour = save;
}

Mouse Event for Left Pressed:
execute code:






if position_meeting(x,y,id)
{
 my_colour=draw_getpixel(mouse_x,mouse_y);
     ini_open("colours.ini");//open ini
    ini_write_real("colours","colour",my_colour);//write a value
    ini_close();//close value
   
}
Draw Event:
execute code:

draw_self();
draw_set_colour(my_colour);
draw_circle(x,y,40,false);

No comments:

This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…

Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital.  ͏     ­͏     ­͏   ...

Contact Form

Name

Email *

Message *