View Single Post
cooba cooba's Avatar

JCF Veteran

Joined: Jan 2004

Posts: 7,812

cooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of lightcooba is a glorious beacon of light

Oct 30, 2013, 12:06 PM
cooba is offline
Reply With Quote
The beauty of custom behaviors is that you no longer need onMain to do anything complicated with objects:
Code:
void AngryEgg(jjOBJ@ obj) {
	jjPLAYER@ p = jjLocalPlayers[obj.creatorID];
	obj.xPos = p.xPos + 50;
	obj.yPos = p.yPos + 50;
	obj.draw();
}

void onLevelLoad() {
	jjObjectPresets[OBJECT::EGGPLANT].behavior = AngryEgg;
	jjObjectPresets[OBJECT::EGGPLANT].bulletHandling = HANDLING::IGNOREBULLET;
}

void onFunction1(jjPLAYER@ p) {
	jjAddObject(OBJECT::EGGPLANT, p.xPos + 50, p.yPos + 50, p.playerID, CREATOR::PLAYER);
	jjAlert("Eggplant added!");
}