depth = -bbox_bottom


controls = {
	left: keyboard_check(ord("A")) || keyboard_check(ord("A")),
	right: keyboard_check(ord("D")),
	up: keyboard_check(ord("W")) || keyboard_check(ord("Z")),
	down: keyboard_check(ord("S")),
	attack_left: keyboard_check_pressed(vk_left),
	attack_right: keyboard_check_pressed(vk_right),
	attack_up: keyboard_check_pressed(vk_up),
	attack_down: keyboard_check_pressed(vk_down),
		
	select_up: keyboard_check_pressed(vk_up) || keyboard_check_pressed(ord("W")),
	select_down: keyboard_check_pressed(vk_down) || keyboard_check_pressed(ord("S"))
}

input_direction = point_direction(0, 0, controls.right - controls.left, controls.down - controls.up)
input_magnitude = (controls.right - controls.left != 0) || (controls.down - controls.up != 0)
	
state.step()

if (place_meeting(x, y, obj_enemy) && !is_mercy){
	with (obj_camera) screen_shake(20, 20)
	is_mercy = true
	
	if (instance_place(x, y, obj_enemy).object_index == obj_enemy_green){
		hp = approach(hp, 0, 2)
		audio_play_sound(sfx_hurt, 2, false)
	}
	else{
		hp = approach(hp, 0, 1)
		audio_play_sound(sfx_hurt, 2, false)
	}
}

if (is_mercy){
	mercy_timer--
}

if (mercy_timer <= 0){
	is_mercy = false
	mercy_timer = mercy_timer_max
}

if (hp == 0){
	global.death_message = "You were killed by an enemy! >:("
	//global.floor_count = 0
	room_goto_next()
}




