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; foot_steps=1;
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; } } if is_moving foot_steps++;
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: ///foot steps if foot_steps==4 { foot_steps=1; feet=instance_create(x,y,obj_foot_steps); switch (dir) { case player_state.up: feet.image_angle=90; feet.image_index=0; break; case player_state.down: feet.image_angle=270; feet.image_index=0; break; case player_state.left: feet.image_angle=180; feet.image_index=1; break; case player_state.right: feet.image_angle=0; feet.image_index=1; break; } }
Draw GUI Event:
execute code: draw_text(20,20," Press R for rain - S for snow");
Information about object: obj_chickenSprite: spr_chicken
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: motion_set(choose(0,180),1+random(1)); alarm[0]=room_speed*3+irandom(room_speed*3); if hspeed<0 image_xscale=-1 else image_xscale=1;Alarm Event for alarm 0:execute code: alarm[0]=room_speed*3+irandom(room_speed*3); hspeed=-hspeed; if hspeed<0 image_xscale=-1 else image_xscale=1;Information about object: obj_butterflySprite: spr_butterfly
Solid: false
Visible: true
Depth: -100
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: path_start(path,1+random(2),path_action_continue,false);Information about object: obj_controlSprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: snow=false; rain=false;Step Event:execute code: if keyboard_check_pressed(ord('S')) { snow=!snow; } if keyboard_check_pressed(ord('R')) { rain=!rain; } if snow effect_create_above(ef_snow,x,y,1,c_white); if rain effect_create_above(ef_rain,x,y,1,c_blue);Information about object: obj_goldSprite: spr_gold
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCollision Event with object obj_player:execute code: effect_create_above(ef_firework,x,y,1,c_red); instance_destroy();Information about object: obj_foot_stepsSprite: spr_foot_steps
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: image_speed=0; fading=false; alarm[0]=room_speed*2; ia=1;Alarm Event for alarm 0:execute code: fading=true;Step Event:execute code: if fading { ia-=0.03; image_alpha=ia; } if ia<0 instance_destroy();Draw Event:execute code: draw_self();
No comments:
Post a Comment