#include "../MS_DefaultFunctions.txt"

@Initialize {
SetDefaultBonusItemEnable(false);
}

@MainLoop {
	yield;
}

@Event {
	alternative(GetEventType())
	case(EV_GET_ITEM) {
		let itemType = GetEventArgument(0);
		alternative(itemType)
		case(1) {
		PlaySound(GetCurrentScriptDirectory ~ "../se/item.wav",255, 0);
		}
		case(2) {
		PlaySound(GetCurrentScriptDirectory ~ "../se/item.wav",255, 0);
		}
		case(3) {
		PlaySound(GetCurrentScriptDirectory ~ "../se/extend.wav",255, 0);
		Extend;
		SetPlayerLife(GetPlayerLife + 1);
		}
		case(4) {
		PlaySound(GetCurrentScriptDirectory ~ "../se/item.wav",255, 0);
		SetPlayerSpell(GetPlayerSpell + 1);
		}
	}
	case(EV_DELETE_SHOT_TO_ITEM){
		BulletScore(GetEventArgument(1));
	}
}

task BulletScore(pos){
	let obj	= CreateItemU2(5, pos[0], pos[1], pos[0], pos[1]-32, 25);
	ObjItem_SetRenderScoreEnable(obj, false);
		
	loop(60){yield;}
	
	ObjItem_SetDefinedMovePatternA1(obj, ITEM_MOVE_TOPLAYER);
	
	while(!Obj_IsDeleted(obj)){
		yield;
	}
}