Sunday, March 28, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【GAMEMAKER】Branching Dialogue

Posted: 28 Mar 2021 02:27 AM PDT

 Information about object: obj_diag_set_up_and_splash

Sprite:
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_one
Sprite: spr_button
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse 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_two
Sprite: spr_button
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse 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_message
Sprite: spr_message_bg
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Step 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_hud
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Draw 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));

【VISUAL VB.NET】Check .NET Frameworks

Posted: 28 Mar 2021 01:37 AM PDT

【FLUTTER ANDROID STUDIO and IOS】real-time object detection with bounding box using tensorflow lite

Posted: 27 Mar 2021 07:33 PM PDT

【PYTHON OPENCV】K-means clustering applied color quantization calculates the color distribution image

Posted: 27 Mar 2021 06:34 PM PDT

【GAMEMAKER】Boss Battle

Posted: 27 Mar 2021 07:39 AM PDT

 Information about object: obj_pirate

Sprite: spr_pirate_idle
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_sword
Sprite: spr_sword_player
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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_bomb
Sprite: spr_bomb
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Step Event:
execute code:

if y>room_height instance_destroy();
Information about object: obj_player
Sprite: spr_player_left
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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_fruit
Sprite: spr_fruit
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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_bomb
Sprite: spr_bomb_mini
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Step Event:
execute code:

///destroy off screen
if y>room_height instance_destroy();
Information about object: obj_enemy_sword
Sprite: spr_sword_enemy
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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_hud
Sprite:
Solid: false
Visible: true
Depth:
20
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Step 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_splash
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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_over
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create 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);

No comments:

Post a Comment