View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,990

Violet CLM has disabled reputation

Jul 13, 2016, 09:56 PM
Violet CLM is offline
Reply With Quote
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.
__________________