
func item_p(x, y) {
	htInsertItem(ITEM_POWER, x, y);
}

func item_b(x, y) {
	htInsertItem(ITEM_BOMB, x, y);
}

func item_l(x, y) {
	htInsertItem(ITEM_LIFE, x, y);
}

func item_c(x, y) {
	htInsertItem(ITEM_CRIX2, x, y);
}

func item_h(x, y) {
	htInsertItem(ITEM_HITX2, x, y);
}


func createCake(x, y, life, scriptFunc, sfCallDur, sfCallTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("cake.png", 0, 0, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 64, 0, 64, 64, 1);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	
	return id;
}

func createCake_Fade(x, y, life, scriptFunc, sfCallDur, sfCallTime, fadeInTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("cake.png", 0, 0, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 64, 0, 64, 64, 1);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	htFadeEnemyIn(id, fadeInTime);
	
	return id;
}

func createEgra(x, y, life, scriptFunc, sfCallDur, sfCallTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("egra.png", 0, 0, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 0, 64, 64, 64, 1);
	htSetEnemyAttackAnim(id, 64, 0, 64, 64, 1);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	
	return id;
}

func createEgra_Fade(x, y, life, scriptFunc, sfCallDur, sfCallTime, fadeInTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("egra.png", 0, 0, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 0, 64, 64, 64, 1);
	htSetEnemyAttackAnim(id, 64, 0, 64, 64, 1);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	htFadeEnemyIn(id, fadeInTime);
	
	return id;
}

func createIcecream(x, y, life, scriptFunc, sfCallDur, sfCallTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("icecream.png", 64, 64, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 0, 64, 64, 64, 1);
	htSetEnemyMovementAnimRect(id, 64, 0, 64, 64, 0, 0, 64, 64);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	
	return id;
}

func createIcecream_Fade(x, y, life, scriptFunc, sfCallDur, sfCallTime, fadeInTime, createFrame) {
	var id;
	
	id = htCreateEnemyWithSpritePath("icecream.png", 64, 64, 64, 64, x, y, life, createFrame);
	htSetEnemyAttackedAnim(id, 0, 64, 64, 64, 1);
	htSetEnemyMovementAnimRect(id, 64, 0, 64, 64, 0, 0, 64, 64);
	htBindScriptFuncToEnemy(id, scriptFunc, sfCallDur, sfCallTime);
	htFadeEnemyIn(id, fadeInTime);
	
	return id;
}

var global_i;
var global_j;

func g_InsertBullet_Circle(ident, color, x, y, start, num, speed) {
	var tmp;
	tmp = 360.0 / num;
	for(global_i=0; global_i<num; ++global_i) {
		htInsertBulletVec(ident, color, x, y, speed, start+tmp*global_i);
	}
}

func g_InsertBullet_Fan(ident, color, x, y, start, dist, num, speed) {
	for(global_i=0; global_i<num; ++global_i) {
		htInsertBulletVec(ident, color, x, y, speed, start+dist*global_i);
	}
}

