Information about object: obj_player
Sprite: spr_idle_down
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 enum player_state { idle, up, down, left, right } dir=player_state.down; is_moving=false; image_speed=0.5;
Step Event:
execute code: ///keypress code if (keyboard_check(vk_left)) { dir=player_state.left; is_moving=true; } else if (keyboard_check(vk_right)) { dir=player_state.right; is_moving=true; } else if (keyboard_check(vk_up)) { dir=player_state.up; is_moving=true; } else if (keyboard_check(vk_down)) { dir=player_state.down; is_moving=true; } else { is_moving=false; }
execute code: ///movement if is_moving { switch (dir) { case player_state.up: y -= 4; break; case player_state.down: y += 4; break; case player_state.left: x -= 4; break; case player_state.right: x += 4; break; } }
execute code: ///animation if is_moving { switch (dir) { case player_state.up: sprite_index=spr_walk_up; break; case player_state.down: sprite_index=spr_walk_down; break; case player_state.left: sprite_index=spr_walk_left; break; case player_state.right: sprite_index=spr_walk_right; break; } } else { switch (dir) { case player_state.up: sprite_index=spr_idle_up; break; case player_state.down: sprite_index=spr_idle_down; break; case player_state.left: sprite_index=spr_idle_left; break; case player_state.right: sprite_index=spr_idle_right; break; } }
execute code: ///dig for treasure if keyboard_check_pressed(ord('Z')) && global.picks>0 { global.picks--; instance_create(x,y,obj_x); instance_create(x,y,obj_has_dug); }
Information about object: obj_treasure_hereSprite: spr_treasure_here
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_treasureSprite: spr_treasure
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectInformation about object: obj_hudSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: global.gold=0; global.picks=50;Draw GUI Event:execute code: draw_set_colour(c_black); draw_set_halign(fa_left); draw_sprite(spr_pick,0,100,100); draw_text(100,160,"Z to Dig - Picks Left "+string(global.picks));Information about object: obj_xSprite: spr_no_treasure
Solid: false
Visible: true
Depth: -50
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: other_id=noone; distance=0; can_show=true; if instance_exists(obj_treasure_here) { other_id=instance_nearest(x,y,obj_treasure_here); } alarm[0]=room_speed*3;Alarm Event for alarm 0:execute code: instance_destroy();Step Event:execute code: if instance_exists(other_id) { distance=round(distance_to_point(other_id.x,other_id.y)); } else { distance=0; }Draw Event:execute code: draw_self(); if distance!=0 && can_show { draw_set_colour(c_yellow); draw_set_halign(fa_center); draw_text(x,y-32,"Nearest Buried Treasure: "+string(distance)+"-Meters"); }Information about object: obj_has_dugSprite: spr_has_dug
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCollision Event with object obj_treasure_here:execute code: instance_create(other.x,other.y,obj_treasure); with (other) instance_destroy();
No comments:
Post a Comment