OBJ_SCOREHIGHSCORE
CREATE EVENT
ini_open("scores.ini");//open file
global.highscore=ini_read_real("scores","high",0);//load scores high if present, otherwise set as 0
ini_close();//close ini
DRAW EVENT
draw_text(100,100,"Highest Score:="+string(global.highscore));//draw value of global.highscore
OBJ_BUTTON
score= get_integer("Enter A Score:", 0);//get an integer
if score>global.highscore//do this if bigger than current score
{
ini_open("scores.ini");//open ini
ini_write_real("scores","high",score);//write a value
ini_close();//close value
global.highscore=score;//update highscore
show_message("High Score Updated");//message
}
else//do this if not bigger than current score
{
show_message("Score Is Not Bigger Than Current Highscore");//message
}
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