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.
movable object that leave trail gamemaker
https://www.youtube.com/watch?v=x29Ok-VxHhw
Information about object: obj_tank
Information about object: obj_tank
Sprite: spr_tank
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: tyre=5;//set inital tyre timer
Step Event:
execute code: ///movement code if keyboard_check(ord('A')) { image_angle+=2; direction=image_angle } if keyboard_check(ord('D')) { image_angle-=2; direction=image_angle } if keyboard_check(ord('W')) { speed+=0.5; } if speed>20 speed=20; speed-=0.2;//add friction if speed<0 speed=0
execute code: ///tyre tyre-=speed; if tyre<0//if count, run the code { tyre=instance_create(x,y,obj_tyre);//create a tyre tyre.image_angle=direction;//set angle to direction of tank tyre=20;//restart timer }
obj_tyre
Information about object: obj_tankSprite: spr_tank Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectCreate Event:
execute code: tyre=5;//set inital tyre timerStep Event:
execute code: ///movement code if keyboard_check(ord('A')) { image_angle+=2; direction=image_angle } if keyboard_check(ord('D')) { image_angle-=2; direction=image_angle } if keyboard_check(ord('W')) { speed+=0.5; } if speed>20 speed=20; speed-=0.2;//add friction if speed<0 speed=0execute code: ///tyre tyre-=speed; if tyre<0//if count, run the code { tyre=instance_create(x,y,obj_tyre);//create a tyre tyre.image_angle=direction;//set angle to direction of tank tyre=20;//restart timer }
onscreen keyboard gamemaker
Information about object: obj_button
Sprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: image_speed=0; letter = "A";//set letter
Step Event:
execute code: if mouse_check_button_pressed(mb_left) && position_meeting(mouse_x,mouse_y,id)//if clicked { global.message+=letter;//add letter to string } if position_meeting(mouse_x,mouse_y,id) { image_index=1; } else { image_index=0; }
Draw Event:
execute code: draw_self(); draw_set_font(fnt_button); draw_set_halign(fa_center); draw_text(x+16, y+4, letter);//draw letter over button
obj obj_enter
create event:
//creating all the buttons //top row var alphabet = "QWERTYUIOP"; for(var i = 0; i<10; i++){ var bt = instance_create(64+i*32+(8*i), 64, obj_button); bt.letter = string_char_at(alphabet, i+1); } //middle row var alphabet = "ASDFGHJKL"; for(var i = 0; i<9; i++){ var bt = instance_create(72+i*32+(8*i), 104, obj_button); bt.letter = string_char_at(alphabet, i+1); } //BOTTOM row var alphabet = "ZXCVBNM"; for(var i = 0; i<7; i++){ var bt = instance_create(88+i*32+(8*i), 144, obj_button); bt.letter = string_char_at(alphabet, i+1); } global.message="";
step event:
if mouse_check_button_pressed(mb_left) && position_meeting(mouse_x,mouse_y,id)//if clicked
{
show_message(global.message);//show typed string
game_restart();
}
draw event: draw_set_halign(fa_left);
draw_text(50,300,"Word "+global.message);//show typed text so far
draw_self();
text based gamemaker
Information about object: obj_question
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: //set variables: data=0; q=1; //open file and read questions: file=file_text_open_read("questions.txt"); while (!file_text_eof(file))//loops until end of file { data++; question[data,1]=file_text_read_string(file);//read question file_text_readln(file); question[data,2]=file_text_read_string(file);//read answer 1 file_text_readln(file); question[data,3]=file_text_read_string(file);//read answer 2 file_text_readln(file); question[data,4]=file_text_read_string(file);//read answer 3 file_text_readln(file); question[data,5]=file_text_read_real(file);//read correct answer 1 file_text_readln(file); } file_text_close(file);
Step Event:
execute code: if (keyboard_check_pressed(vk_left)) {q-=1;}//change question number if (keyboard_check_pressed(vk_right)) {q+=1;}//change question number if q==0 q=data;//keep in range if q==(data+1) q=1;//keep in range
Draw Event:
execute code: //draw the data draw_text(50,100,question[q,1]); draw_text(50,200,question[q,2]); draw_text(50,300,question[q,3]); draw_text(50,400,question[q,4]); draw_text(50,500,question[q,5]);
world clock gamemaker
Information about object: obj_world_clock
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: ///set up variables //set time zone date_set_timezone(timezone_utc);//get local time london_hour=0; london_minute=0; london_second=0; newyork_hour=0; newyork_minute=0; newyork_second=0; sydney_hour=0; sydney_minute=0; sydney_second=0;
Step Event:
execute code: //calculations will differ depending where in the world you are london_hour=date_get_hour(date_current_datetime());//get local time london_minute=date_get_minute(date_current_datetime());//get local time london_second=date_get_second(date_current_datetime());//get local time newyork_hour=(london_hour+19+24) mod 24;//set newyork time newyork_minute=london_minute; newyork_second=london_second; sydney_hour=(london_hour+10) mod 24;//set sydney time sydney_minute=london_minute; sydney_second=london_second; london_hour_string=string(london_hour); if string_length(london_hour_string)==1 london_hour_string="0"+london_hour_string; london_minute_string=string(london_minute); if string_length(london_minute_string)==1 london_minute_string="0"+london_minute_string; london_second_string=string(london_second); if string_length(london_second_string)==1 london_second_string="0"+london_second_string; newyork_hour_string=string(newyork_hour); if string_length(newyork_hour_string)==1 newyork_hour_string="0"+newyork_hour_string; newyork_minute_string=string(newyork_minute); if string_length(newyork_minute_string)==1 newyork_minute_string="0"+newyork_minute_string; newyork_second_string=string(newyork_second); if string_length(newyork_second_string)==1 newyork_second_string="0"+newyork_second_string; sydney_hour_string=string(sydney_hour); if string_length(sydney_hour_string)==1 sydneyhour_string="0"+sydney_hour_string; sydney_minute_string=string(sydney_minute); if string_length(sydney_minute_string)==1 sydney_minute_string="0"+sydney_minute_string; sydney_second_string=string(sydney_second); if string_length(sydney_second_string)==1 sydney_second_string="0"+sydney_second_string;
Draw Event:
execute code: //draw times draw_text(50,50,"london "+london_hour_string+":"+london_minute_string+" - "+london_second_string); draw_text(50,150,"newyork "+newyork_hour_string+":"+newyork_minute_string+" - "+newyork_second_string); draw_text(50,250,"sydney "+sydney_hour_string+":"+sydney_minute_string+" - "+sydney_second_string);
Subscribe to:
Posts (Atom)
I Quit AeroMedLab
Watch now (2 mins) | Today is my last day at AeroMedLab ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....