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.
gamemaker two separate views
Information about object: obj_player_1
Sprite: spr_player_1
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
Step Event:
execute code: //movement code if (keyboard_check(ord('A'))) {x-=5;} if (keyboard_check(ord('D'))) {x+=5;} if (keyboard_check(ord('W'))) {y-=5;} if (keyboard_check(ord('S'))) {y+=5;}
Information about object: obj_player_2Sprite: spr_player_2 Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectStep Event:execute code: //movement code if (keyboard_check(vk_left)) {x-=5;} if (keyboard_check(vk_right)) {x+=5;} if (keyboard_check(vk_up)) {y-=5;} if (keyboard_check(vk_down)) {y+=5;}Information about object: obj_next_roomSprite:Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics ObjectCreate Event:execute code: room_goto(room_example);Information about object: obj_view_controlSprite:Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics ObjectCreate Event:execute code: view_enabled[0] = true;//enable view view_visible[0] = true;//make visibleview_xview[0]=800;//set wiew widthv view_xview[0]=0;//set view position view_yview[0]=0; view_wview[0]=400;//set size of view view_hview[0]=400; view_xport[0]=0;//set position of port view_yport[0]=0; view_wport[0]=400;//set size of port view_hport[0]=400; view_object[0]=obj_player_1;//set object to follow view_hborder[0] = view_wview[0] / 2; view_vborder[0] = view_hview[0] / 2; view_enabled[1] = true;//enable view view_visible[1] = true;//make visibleview_xview[0]=800;//set wiew widthv view_xview[1]=0; view_yview[1]=0; view_wview[1]=400; view_hview[1]=400; view_xport[1]=400; view_yport[1]=0; view_wport[1]=400; view_hport[1]=400; view_object[1]=obj_player_2;//set object to follow view_hborder[1] = view_wview[0] / 2; view_vborder[1] = view_hview[0] / 2;Draw GUI Event:execute code: draw_rectangle(1,1,399,399,true); draw_rectangle(401,1,799,399,true);
gamemaker gorilla, worms, angry bird type game
Information about object: obj_player_1
Sprite: spr_player_1
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 initial values strength=0; angle=0; global.player=1;//set player to go first
Alarm Event for alarm 0:
execute code: global.player=2;//allow next player to go
Step Event:
execute code: if global.player==1//check if players go { strength=distance_to_point(mouse_x,mouse_y)/50;//calculate strength based on distance to mouse angle=point_direction(x,y,mouse_x,mouse_y);//get the angle if mouse_check_button_released(mb_left)//do this when mouse released { bullet=instance_create(x,y,obj_bullet_1);//create a bullet and assign bullet.speed=strength;//set its speed bullet.direction=angle;//set direction global.player=0;//prevent shooting alarm[0]=room_speed*2;//start an alarm } }
Draw Event:
execute code: draw_self(); if global.player==1// do this if players go { draw_text(x,y-40,"strength="+string(strength)); draw_text(x,y-80,"angle="+string(angle)); draw_line(x,y,mouse_x,mouse_y); }
Information about object: obj_player_2Sprite: spr_player_2 Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectCreate Event:
execute code: //set initial values strength=0; angle=0;Alarm Event for alarm 0:
execute code: global.player=1;//allow next player to goStep Event:
execute code: if global.player==2//check if players go { strength=distance_to_point(mouse_x,mouse_y)/50;//calculate strength based on distance to mouse angle=point_direction(x,y,mouse_x,mouse_y);//get the angle if mouse_check_button_released(mb_left)//do this when mouse released { bullet=instance_create(x,y,obj_bullet_2);//create a bullet and assign bullet.speed=strength;//set its speed bullet.direction=angle;//set direction global.player=0;//prevent shooting alarm[0]=room_speed*2;//start an alarm } }Draw Event:
execute code: draw_self(); if global.player==2// do this if players go { draw_text(x,y-40,"strength="+string(strength)); draw_text(x,y-80,"angle="+string(angle)); draw_line(x,y,mouse_x,mouse_y); }Information about object: obj_bullet_1Sprite: spr_bullet Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectStep Event:
execute code: vspeed=vspeed+0.02;//apply gravity effectCollision Event with object obj_player_2:
execute code: show_message("player 1 wins"); game_restart();Information about object: obj_bullet_2Sprite: spr_bullet Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectStep Event:
execute code: vspeed=vspeed+0.02;//apply gravity effectCollision Event with object obj_player_1:
execute code: show_message("player 2 wins"); game_restart();
gamemaker Mini Golf Game
Information about object: obj_ball
Sprite: spr_ball
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: strength=0;//set up
Step Event:
execute code: strength=distance_to_point(mouse_x,mouse_y)/5;//calculate strength based on distance to mouse if mouse_check_button_released(mb_left)//do this when mouse released { direction=point_direction(x,y,mouse_x,mouse_y);//setdirection towards mouse speed=strength;//set the speed } speed*=0.9;//simuate some friction if speed<0.5 speed=0;
Collision Event with object obj_hole:
execute code: if speed<1//check if over hole and not too fast { show_message("you win"); game_restart(); }
Collision Event with object obj_wall:
execute code: move_bounce_solid(true);//bounce off of object
Draw Event:
execute code: draw_self(); draw_text(x,y-20,strength);//show strength near ball
gamemaker blitz game
Information about object: obj_player
Sprite: spr_player
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: global.can_shoot=true; motion_set(0,4);
Step Event:
execute code: if x>1000 { y+=16; x=-32; } if mouse_check_button_pressed(mb_left) && global.can_shoot { instance_create(x,y+16,obj_bomb); global.can_shoot=false; }
Collision Event with object obj_tower:
execute code: show_message("You died"); game_restart();
Information about object: obj_bombSprite: spr_bomb Solid: false Visible: true Depth: 0 Persistent: false Parent:Children: Mask: No Physics ObjectCreate Event:execute code: motion_set(270,3);Step Event:execute code: if y>800 { instance_destroy(); global.can_shoot=true; }Collision Event with object obj_tower:execute code: with (other) instance_destroy(); global.can_shoot=true; instance_destroy();
color pallete picker gamemaker
Information about object: obj_pallete
Sprite: spr_pallete
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: my_colour=c_black;
Mouse Event for Left Pressed:
execute code: if position_meeting(x,y,id) { my_colour=draw_getpixel(mouse_x,mouse_y); }
gamemaker spawner
Information about object: obj_spawner
Sprite: spr_spawner
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
Step Event:
execute code: if(mouse_check_button_pressed(mb_left)) { var _inst=instance_create(x,y,obj_spawned); _inst.target_x=mouse_x; _inst.target_y=mouse_y; }
Information about object: obj_spawnedSprite:Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics ObjectCreate Event:execute code: ///Properties timer=0; z=0; start_x=obj_spawner.x; start_y=obj_spawner.y; target_x=noone; target_y=noone; length=room_speed/2; shadow_alpha=0; shadow_alpha_min=.25; shadow_alpha_max=.5; shadow_scale=1; shadow_scale_min=.5; shadow_scale_max=1;Step Event:execute code: if(timer<length) timer++; else timer=length; x=lerp(start_x,target_x,timer/length); y=lerp(start_y,target_y,timer/length); z=arc(0,32,0,timer/length,.8); shadow_alpha=lerp(shadow_alpha_max,shadow_alpha_min,z/32); shadow_scale=lerp(shadow_scale_max,shadow_scale_min,z/32); /* shadow_alpha=0; shadow_alpha_min=.25; shadow_alpha_max=.5; shadow_scale=1; shadow_scale_min=.5; shadow_scale_max=1;Draw Event:execute code: ///draw self depth=-y; draw_sprite_ext(spr_shadow,0,x,y,shadow_scale,shadow_scale,0,c_white,.5); draw_sprite(spr_thing,0,x,y-z);///arc(start[0], peak[1], floor[2], position[3], bias[4]) if(argument[3]<=.5) return(lerp(argument[0],argument[1],bias(argument[4],argument[3]*2))); else { var b=1-argument[4]; var p=2*argument[3]-1 return(lerp(argument[1],argument[2],bias(b,p))); }bias(b,t){ return argument1/((1/argument0-2)*(1-argument1)+1); }
Subscribe to:
Posts (Atom)
How the New York Times led to the fall of Assad
Anti-semitism by the New York Times actually made Israel safer ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....