Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if global.pause = 0 && global.stop = 0{
- if global.hurt = 0 image_alpha = 1;
- //when hit
- if global.hurt = 1
- {
- global.hurt = 2;
- global.hp = global.hp - 1
- image_alpha=0.5;
- alarm[0] = 50; //invincibility frames
- }
- //death
- if global.hp = 0
- {
- room_goto(rm_death);
- global.hp = global.maxhp;
- }
- //movement and collision
- if (keyboard_check(ord("D")))
- {
- sprite_index = spr_player_right;
- if
- !place_meeting(x + 5, y, obj_wall) &&
- !place_meeting(x + 5, y, obj_guide) &&
- !place_meeting(x + 5, y, obj_gate) &&
- !place_meeting(x + 5, y, obj_cryguy) &&
- !place_meeting(x + 5, y, obj_bed)
- x = x + 4;
- }
- if (keyboard_check(ord("A")))
- {
- sprite_index = spr_player_left;
- if
- !place_meeting(x - 5, y, obj_wall) &&
- !place_meeting(x - 5, y , obj_guide) &&
- !place_meeting(x - 5, y , obj_gate) &&
- !place_meeting(x - 5, y, obj_cryguy) &&
- !place_meeting(x - 5, y , obj_bed)
- x = x - 4;
- }
- if (keyboard_check(ord("W")))
- {
- sprite_index = spr_player_back;
- if
- !place_meeting(x, y - 5, obj_wall) &&
- !place_meeting(x, y - 5, obj_guide) &&
- !place_meeting(x, y - 5, obj_gate) &&
- !place_meeting(x, y - 5, obj_cryguy) &&
- !place_meeting(x, y - 5, obj_bed)
- y = y - 4;
- }
- if (keyboard_check(ord("S")))
- {
- sprite_index = spr_player;
- if
- !place_meeting(x, y + 5, obj_wall) &&
- !place_meeting(x, y + 5, obj_guide) &&
- !place_meeting(x, y + 5, obj_gate) &&
- !place_meeting(x, y + 5, obj_cryguy) &&
- !place_meeting(x, y + 5, obj_bed)
- y = y + 4;
- }
- //shooting
- if ((keyboard_check(vk_right))
- or (keyboard_check(vk_left))
- or (keyboard_check(vk_down))
- or (keyboard_check(vk_up)))
- && (cooldown < 1)
- {
- instance_create_layer(x,y,"Bullets",obj_bullet)
- cooldown = 10;
- }
- cooldown = cooldown - 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement