Gamemaker Random Dice Roller

create event:

//set up dice
dice1=0;
dice2=0;
dice3=0;
dice4=0;
dice5=0;

step event:

if position_meeting(mouse_x,mouse_y,id) && mouse_check_button_released(mb_left)//if button press released
{
dice1=irandom_range(1,6);//choose a random value for dice
dice2=irandom_range(1,6);
dice3=irandom_range(1,6);
dice4=irandom_range(1,6);
dice5=irandom_range(1,6);
}

draw event:

draw_self();
draw_sprite(spr_dice,dice1,50,50);//draw choosen sub image
draw_sprite(spr_dice,dice2,150,50);
draw_sprite(spr_dice,dice3,250,50);
draw_sprite(spr_dice,dice4,350,50);
draw_sprite(spr_dice,dice5,450,50);





No comments:

When Bad People Make Good Art

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

Contact Form

Name

Email *

Message *