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】Branching Dialogue
Information about object: obj_diag_set_up_and_splash
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 array to hold data // 1 question // 2 answer a // 3 answer b // 4 answer a target [0 is none] // 5 answer b target [0 is none] global.diag[1,1]="Are you in a good mood?"; global.diag[1,2]="Yes, I'm in great mood."; global.diag[1,3]="No, I'm sad."; global.diag[1,4]=2; global.diag[1,5]=3; global.diag[2,1]="That's great!#Would you like#some cheese?"; global.diag[2,2]="Yyes, I love cheese."; global.diag[2,3]="No. I'll pass."; global.diag[2,4]=4; global.diag[2,5]=5; global.diag[3,1]="Too bad.#Can I sing#you a song?"; global.diag[3,2]="Yes. Sing me a#shanty song."; global.diag[3,3]="No. I'd rather you didn't."; global.diag[3,4]=6; global.diag[3,5]=7; global.diag[4,1]="Brie or stilton?"; global.diag[4,2]="Brie, please."; global.diag[4,3]="Stilton, please."; global.diag[4,4]=10; global.diag[4,5]=8; global.diag[5,1]="How about some gold?"; global.diag[5,2]="Yes, i'm after gold."; global.diag[5,3]="No, i have enough already."; global.diag[5,4]=11; global.diag[5,5]=14; global.diag[6,1]="Yo ho ho &#a bottle of rum.#Want some rum?"; global.diag[6,2]="Yes. Hmm rum."; global.diag[6,3]="No. I don't drink."; global.diag[6,4]=15; global.diag[6,5]=12; global.diag[7,1]="OK. Want to go fishing?"; global.diag[7,2]="Yes. Sounds good!"; global.diag[7,3]="No. Fishing is boring."; global.diag[7,4]=9; global.diag[7,5]=13; global.diag[8,1]="Yuck! I prefer brie.##[r to restart]"; global.diag[8,2]=""; global.diag[8,3]=""; global.diag[8,4]=0; global.diag[8,5]=0; global.diag[9,1]="Awesome! I'll get my rod.##[r to restart]"; global.diag[9,2]=""; global.diag[9,3]=""; global.diag[9,4]=0; global.diag[9,5]=0; global.diag[10,1]="Great choice!##[r to restart]"; global.diag[10,2]=""; global.diag[10,3]=""; global.diag[10,4]=0; global.diag[10,5]=0; global.diag[11,1]="Here's 1,000 coins.##[r to restart]"; global.diag[11,2]=""; global.diag[11,3]=""; global.diag[11,4]=0; global.diag[11,5]=0; global.diag[12,1]="Probably for the best!##[r to restart]"; global.diag[12,2]=""; global.diag[12,3]=""; global.diag[12,4]=0; global.diag[12,5]=0; global.diag[13,1]="OK be boring then!##[r to restart]"; global.diag[13,2]=""; global.diag[13,3]=""; global.diag[13,4]=0; global.diag[13,5]=0; global.diag[14,1]="No gold! Your choice.##[r to restart]"; global.diag[14,2]=""; global.diag[14,3]=""; global.diag[14,4]=0; global.diag[14,5]=0; global.diag[15,1]="Don't drink too much!##[r to restart]"; global.diag[15,2]="Continue"; global.diag[15,3]=""; global.diag[15,4]=16; global.diag[15,5]=0; global.diag[16,1]="Maybe just have a coffee.##[r to restart]"; global.diag[16,2]=""; global.diag[16,3]=""; global.diag[16,4]=0; global.diag[16,5]=0; global.message=1; global.gold=0; room_goto(room_dialogue); Information about object: obj_button_oneSprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectMouse Event for Left Released:execute code: ///Example Do Something - ie choose yes to question 5 if global.message==5 { global.gold+=1000; } //for every click global.message=global.diag[global.message,4];Draw Event:execute code: if global.diag[global.message,2]!="" { var width=string_width(global.diag[global.message,2]); if width>50 // adjust image size if a long text option { var size=(250+(width-50))/250 image_xscale=size; } draw_self(); draw_set_font(font_message); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_colour(c_black); draw_text(x,y,global.diag[global.message,2]); }Information about object: obj_button_twoSprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectMouse Event for Left Pressed:execute code: global.message=global.diag[global.message,5];Draw Event:execute code: if global.diag[global.message,3]!="" { var width=string_width(global.diag[global.message,3]); if width>50 // adjust image size if a long text option { var size=(250+(width-50))/250 image_xscale=size; } draw_self(); draw_set_font(font_message); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_colour(c_black); draw_text(x,y,global.diag[global.message,3]); }Information about object: obj_show_messageSprite: spr_message_bg
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: if keyboard_check_released(ord('R')) { game_restart(); }Draw Event:execute code: draw_self(); draw_set_font(font_message_big); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_colour(c_black); draw_text(x,y,global.diag[global.message,1]);Information about object: obj_gold_hudSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectDraw Event:execute code: draw_set_font(font_message_big); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_set_colour(c_black); draw_text(room_width/2,room_height-50,"Gold: "+string(global.gold));
【GAMEMAKER】Boss Battle
Information about object: obj_pirate
Sprite: spr_pirate_idle
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: slot=4; alarm[0]=global.game_speed; alarm[1]=room_speed*5; //scatter bombs alarm[2]=room_speed*8; //throw sword alarm[3]=room_speed*10; //jump up dir=choose("left","right");
Alarm Event for alarm 0:
execute code: ///drop a bomb / fruit & increase speed global.game_speed--; if global.game_speed<2 global.game_speed=2; alarm[0]=global.game_speed; drop=choose("bomb","fruit","fruit"); if drop=="bomb" { var bomb=instance_create(slot*64,120,obj_bomb); bomb.direction=270; bomb.speed=2; //audio_play_sound(choose(snd_ar_1,snd_ar_2),1,false); } if drop=="fruit" { var fruit=instance_create(slot*64,120,obj_fruit); fruit.direction=270; fruit.speed=2; //audio_play_sound(snd_bonus_coming,1,false); }
execute code: ///reset alarm alarm[0]=global.game_speed;
execute code: ///move //weigh it to move away from edge if slot==11 dir="left"; if slot==1 dir="right"; //choose next direction - wieghed to move in same direction dir=choose("left","right",dir,dir); if dir=="left" { image_xscale=-1; slot--; } if dir=="right" { image_xscale=1; slot++; } //keep in range if slot<1 slot=1; if slot>11 slot=11;
Alarm Event for alarm 1:
execute code: ///send bomb scatter alarm[1]=room_speed*5; var loop; for (loop = 210; loop < 350; loop += 15) { //audio_play_sound(choose(snd_ar_3,snd_ar_4),1,false); var bomb=instance_create(x,y,obj_scatter_bomb); bomb.direction=loop; bomb.speed=3; }
Alarm Event for alarm 2:
execute code: alarm[2]=room_speed*8; //throw sword var sword=instance_create(x,y,obj_enemy_sword); sword.direction=point_direction(x,y,obj_player.x,obj_player.y); sword.speed=5;
Alarm Event for alarm 3:
execute code: ///jump up sprite_index=spr_pirate_jump; image_speed=0.5; image_index=0; alarm[3]=room_speed*10;
Step Event:
execute code: ///move to position slot move_towards_point(64*slot,y,4); //stop if x==64*slot { dir="idle"; speed=0; }
execute code: ///sprite control if sprite_index==spr_pirate_jump && image_index>=15 { sprite_index=spr_pirate_idle; image_index=0; image_speed=1; }
Collision Event with object obj_player_sword:
execute code: if sprite_index==spr_pirate_jump { global.enemyhp-=5; //audio_play_sound(choose(snd_pirate_ouch_1,snd_pirate_ouch_2),1,false); } with (other) instance_destroy();
Information about object: obj_player_swordSprite: spr_sword_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(180,1); ang=0;//initial angle sw=0;//for sine wave move_angle=40;Step Event:execute code: ///rotate && check if outside room sw += pi/30;//for sine wave - ie speed angle=sin(sw) * move_angle;//for sine wave image_angle=angle+225; if y<0 instance_destroy();Information about object: obj_bombSprite: spr_bomb
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: if y>room_height instance_destroy(); Information about object: obj_playerSprite: spr_player_left
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: slot=4; idle=0; left=1; right=2 dir=left; can_shoot=true;Alarm Event for alarm 0:execute code: can_shoot=true;Step Event:execute code: ///movement && shoot if keyboard_check_pressed(vk_left) && slot>1 { slot--; dir=left; move_towards_point(64*slot,y,4); } if keyboard_check_pressed(vk_right) && slot<11 { slot++; dir=right; move_towards_point(64*slot,y,4); } //keep in range if slot<1 slot=1; if slot>11 slot=11; //stop if x==64*slot { dir=idle; speed=0; } //make a sword if keyboard_check_pressed(vk_up) && can_shoot { can_shoot=false; alarm[0]=room_speed; var sword=instance_create(x,y,obj_player_sword); sword.direction=90; sword.speed=5; }execute code: ///animation if dir=left sprite_index=spr_player_left; if dir=right sprite_index=spr_player_right;Collision Event with object obj_bomb:execute code: global.p1hp-=1; //audio_play_sound(choose(snd_laugh_1,snd_laugh_2),1,false); with(other) instance_destroy();Collision Event with object obj_fruit:execute code: global.enemyhp-=1; //audio_play_sound(snd_bonus,1,false); with(other) instance_destroy();Collision Event with object obj_scatter_bomb:execute code: global.p1hp-=1; //audio_play_sound(choose(snd_ouch,snd_ouch_2,snd_ouch_3),1,false); with(other) instance_destroy();Collision Event with object obj_enemy_sword:execute code: global.p1hp-=5; //audio_play_sound(snd_ouch_4,1,false); with (other) instance_destroy();Information about object: obj_fruitSprite: spr_fruit
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: irandom(image_number-1); image_speed=0;Step Event:execute code: if y>room_height instance_destroy(); Information about object: obj_scatter_bombSprite: spr_bomb_mini
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: ///destroy off screen if y>room_height instance_destroy();Information about object: obj_enemy_swordSprite: spr_sword_enemy
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(180,1); ang=0;//initial angle sw=0;//for sine wave move_angle=40;Step Event:execute code: ///rotate && check if outside room sw += pi/30;//for sine wave - ie speed angle= sin(sw) * move_angle;//for sine wave image_angle=angle+45; if y>room_height instance_destroy();Information about object: obj_hudSprite:
Solid: false
Visible: true
Depth: 20
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: if global.p1hp<0 { global.message="Enemy Wins"; // for gameover screen room_goto(room_game_over); } if global.enemyhp<0 { global.message="Player Wins"; // for gameover screen room_goto(room_game_over); }Draw Event:execute code: draw_rectangle_colour(0, 0, room_width, room_height, c_blue, c_blue, c_white, c_white, false);Draw GUI Event:execute code: ///draw hp //hp player draw_rectangle_colour(334,10,334-(global.p1hp*2),30,c_green,c_red,c_red,c_green,false); draw_set_colour(c_red); draw_rectangle(334,10,334-200,30,true); //draw enemy draw_rectangle_colour(434,10,434+(global.enemyhp*2),30,c_red,c_green,c_green,c_red,false); draw_set_colour(c_red); draw_rectangle(434,10,434+200,30,true); //draw text draw_set_font(font_mini); draw_set_colour(c_black); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_text(234,20,"Player HP"); draw_text(534,20,"Enemy HP"); draw_text(room_width/2,620,"Arrow Keys To Move And Fire - Shoot Enemy (when jumping)#Collect Fruit - Avoid Bombs"); Information about object: obj_splashSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: ///set up global.p1hp=100; global.enemyhp=100; global.game_speed=150; room_goto(room_game);Keyboard Event for <Left> Key:execute code: global.p1hp-=1;Keyboard Event for <Right> Key:execute code: global.p1hp+=1;Information about object: obj_game_overSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: alarm[0]=room_speed*5;Alarm Event for alarm 0:execute code: game_restart();Draw Event:execute code: draw_text(200,200,global.message);
【GAMEMAKER】Frogger Game Remake
Information about object: obj_parent
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children
obj_car_1
obj_car_2
obj_car_3
obj_car_4
obj_wood_parent
Mask:
obj_car_1
obj_car_2
obj_car_3
obj_car_4
obj_wood_parent
No Physics Object
Step Event:
execute code: //wrap around room if x<-(sprite_width/2) x=(room_width+1)+(sprite_width/2); if x>(room_width+1)+(sprite_width/2) x=-(sprite_width/2);
Information about object: obj_car_1Sprite: spr_car_1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(180,2);Information about object: obj_car_2Sprite: spr_car_2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(0,2);Information about object: obj_car_3Sprite: spr_car_3
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(0,2);Information about object: obj_car_4Sprite: spr_car_4
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(180,2);Information about object: obj_borderSprite: spr_border
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_waterSprite: spr_water
Solid: false
Visible: true
Depth: 20
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_wood_leftSprite: spr_wood
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_wood_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(180,3);Information about object: obj_wood_rightSprite: spr_wood
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_wood_parent
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(0,3);Information about object: obj_wood_parentSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_parent
ChildrenMask:
obj_wood_left
obj_wood_right No Physics ObjectInformation about object: obj_frogSprite: spr_frog
Solid: false
Visible: true
Depth: -30
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: //movement 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;} //check if game won if (place_meeting(x,y,obj_win) and not place_meeting(x,y,obj_croc)) { show_message("You win"); game_restart(); } //check if collision with croc if (place_meeting(x,y,obj_croc)) { show_message("You die"); game_restart(); } //check if car collision, border, or water & not log if (place_meeting(x,y,obj_car_1) or place_meeting(x,y,obj_car_2) or place_meeting(x,y,obj_car_3) or place_meeting(x,y,obj_car_4) or place_meeting(x,y,obj_border)) or (place_meeting(x,y,obj_water) and not place_meeting(x,y,obj_wood_parent)) { show_message("You die"); game_restart(); } //move left if collide with obj_wood_left if (place_meeting(x,y,obj_wood_left)) { x-=3; } //move right if collide with obj_wood_right if (place_meeting(x,y,obj_wood_right)) { x+=3; } Information about object: obj_winSprite: spr_win
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_crocSprite: spr_croc
Solid: false
Visible: true
Depth: -25
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: alarm[0]=3*room_speed;Alarm Event for alarm 0:execute code: x=choose(200,400,600); alarm[0]=3*room_speed;
Visual Studio: Visual C# Ping Example
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net.NetworkInformation;
using System.Threading;
namespace Ping_example
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click_1(object sender, EventArgs e)
{
for (int i = 0; i < 4; ++i)
{
using (Ping p = new Ping())
{
listView1.Items.Add(p.Send("www.google.com").RoundtripTime.ToString() + "ms\n");
}
}
}
}
}
// make sure that using System.Runtime.InteropServices; is included
// make sure that using System.Net.NetworkInformation; is included
// make sure that using System.Threading; is included for method Sleep
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....