Monday, 12 April 2021

【GAMEMAKER】Fishing_Mini_Game

 Information about object: obj_splash

Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

score=0;
lives=10;
health=100;
room_goto(room_game);

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*6;
Alarm Event for alarm 0:
execute code:

game_restart();
Draw Event:
execute code:

draw_set_font(font_info_big);
draw_set_halign(fa_center);
draw_text(400,100,"Final Score #"+string(score));

Information about object: obj_hud_and_spawn
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///alarms
alarm[0]=room_speed*3;//for bubble

alarm[1]=room_speed*4;//for fish

alarm[2]=room_speed*4;//for timer (health)

Alarm Event for alarm 0:
execute code:

instance_create(x,y,obj_bubble);
alarm[0]=room_speed*3;
Alarm Event for alarm 1:
execute code:

alarm[1]=room_speed*4;//for fish

instance_create(x,y,choose(obj_fish_1,obj_fish_1,obj_fish_2,obj_fish_2
,obj_fish_3,obj_fish_3,obj_fish_4,obj_fish_4,obj_fish_5,obj_fish_5,
obj_fish_6,obj_fish_6));
Alarm Event for alarm 2:
execute code:

alarm[2]=room_speed*4;//for timer (health)
health--;
if health<0 room_goto(room_gameover);
Draw Event:
execute code:


draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(font_info_small);
draw_text(room_width/2,520,"Left & Right To Extend Rod - Down To Drop Line#Get Hook In Mouth");
draw_text(room_width/2,40,"Score "+string(score));
draw the health bar with size (20,570,780,580) with back color teal and bar color green to red

Information about object: obj_bubble
Sprite: spr_bubble
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

ang=0;//initial angle
sw=0;//for sine wave
move_angle=5+irandom(10);
base=irandom_range(100,700);
x=base;
y=room_height+64;

scale=irandom_range(1,20);
scale*=0.1;
image_xscale=scale;
image_yscale=scale;
motion_set(90,1+scale);
depth=choose(-50,50);
Step Event:
execute code:

sw += 0.1;//for sin wave - ie speed
angle= sin(sw) * move_angle;//for sin wave
x=base+angle;

Information about object: obj_fish_1
Sprite: spr_fish_1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=10;
event_inherited();

Information about object: obj_fish_2
Sprite: spr_fish_2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=20;
event_inherited();
Information about object: obj_fish_3
Sprite: spr_fish_3
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=10;
event_inherited();

Information about object: obj_fish_4
Sprite: spr_fish_4
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=5;
event_inherited();

Information about object: obj_fish_5
Sprite: spr_fish_5
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=25;
event_inherited();

Information about object: obj_fish_6
Sprite: spr_fish_6
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_fish_parent
Children:
Mask:
No Physics Object
Create Event:
execute code:

size=40;
event_inherited();

Information about object: obj_dock
Sprite: spr_dock
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_fisher
Sprite: spr_fisher
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_hook
Sprite: spr_hook
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

verdir="up";
hordir="right";
Step Event:
execute code:

///movement
if keyboard_check(vk_left) hordir="left";
if keyboard_check(vk_right) hordir="right";
if keyboard_check(vk_up) verdir="up";
if keyboard_check(vk_down) verdir="down";

if hordir=="left" x-=2;
if hordir=="right" x+=2;
if verdir=="up" y-=4;
if verdir=="down" y+=4;

if y<96 y=96;
if y>room_height-30 y=room_height-30;
if x<160 x=160;
if x>room_width-100 x=room_width-100;


Collision Event with object obj_shark:
execute code:

score--;
Draw Event:
execute code:

///draw hook, rod and line
//draw hook
draw_self();
//draw_rod
draw_set_colour(c_maroon);
draw_line_width(96,70,x,90,6);
// draw fishing line
draw_set_colour(c_black);
draw_line_width(x,90,x,y,2);

Information about object: obj_fish_parent
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children
obj_fish_1
obj_fish_2
obj_fish_3
obj_fish_4
obj_fish_5
obj_fish_6
Mask:
No Physics Object
Create Event:
execute code:

dir=choose("left","right");
depth=choose(-50,50);
y=irandom_range(120,540);
spd=random_range(1,4);
scale=random(2)+0.3;
if dir=="right"
{
    x=-100;
    direction=0;
    image_xscale=scale;
    image_yscale=scale;
}
if dir=="left"
{
    x=room_width+100;
    direction=180;
    image_xscale=-scale;
    image_yscale=scale;
}
speed=spd;
Step Event:
execute code:

if point_distance(x,y,obj_hook.x,obj_hook.y)<15
{
    score+=size*scale;
    instance_destroy();
}

if x>room_width+200 instance_destroy();
if x<-200 instance_destroy();

Information about object: obj_jellyfish
Sprite: spr_jellyfish
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

path_start(path_jelly,3,path_action_continue,true);
Step Event:
execute code:

image_angle=direction;

Information about object: obj_shark
Sprite: spr_shark
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

y=irandom_range(200,500);
motion_set(0,2+random(2));

Step Event:
execute code:

if x>900
{
    x=850;
    y=irandom_range(200,500);
    image_xscale=-1;
    motion_set(180,2+random(2));
}
if x<-100
{
    x=50;
    y=irandom_range(200,500);
    image_xscale=1;
    motion_set(0,2+random(2));
}

No comments:

Post a Comment

BREAKING: North Carolina automotive group acquires 7 Upstate dealerships

Breaking news from GSA Business Report Click here to view this message in a browser window. ...