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);
Search thousands of free JavaScript snippets that you can quickly copy and paste into your web pages. Get free JavaScript tutorials, references, code, menus, calendars, popup windows, games, and much more.
Subscribe to:
Post Comments (Atom)
When Bad People Make Good Art
I offer six guidelines on cancel culture ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....
No comments:
Post a Comment