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!");
}
|