Code:
void onMain() {
for (int i = 1; i < jjObjectCount; ++i) {
jjOBJ@ obj = jjObjects[i];
if (obj.behavior == BEHAVIOR::MONKEYBULLET)
obj.behavior = BananaMaker;
}
}
void BananaMaker(jjOBJ@ obj) {
//bounce off walls and stuff, then eventually:
jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.objectID, OBJECT::CREATOR, function(obj){ obj.behave(BEHAVIOR::MONKEYBULLET); });
}
Something like that. Yes, you could recreate the monkey behavior and skip over this stuff, but the above feels like less work for nearly the same effect.
__________________
|