Quote:
Originally Posted by XxMoNsTeRXM
How can I make a Tuf Boss become an enemy?
|
Code:
void onLevelLoad() {
jjObjectPresets[OBJECT::TUFBOSS].behavior = BEHAVIOR::WALKINGENEMY;
}
Quote:
Originally Posted by incandescentembers
I know I may be asking for too much, but can any one show me how can I build the easiest enemy that comes to my mind: that spiky ball from Technoir, which just moves from one wall to another. Let's just say that I have a one tile ball in my tileset and I just want to add to that ball the exactly same behavior as the mentioned enemy from Technoir: that is, moving horizontally from one wall to another. It hurts you when you touch it, you can kill it. Pretty plzzz?
|
Code:
void onLevelLoad() {
jjObjectPresets[OBJECT::THING].behavior = Spikeball;
}
void Spikeball(jjOBJ@ obj) {
jjOBJ@ exp;
switch (obj.state) {
case STATE::START:
obj.direction = obj.xSpeed = -2;
obj.determineCurAnim(ANIM::DESTSCEN, 4); //32x32 square sprite
obj.determineCurFrame();
obj.bulletHandling = HANDLING::HURTBYBULLET;
obj.playerHandling = HANDLING::ENEMY;
obj.state = STATE::FLY;
case STATE::FLY:
obj.xPos = obj.xPos + obj.xSpeed;
if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 16 : obj.xPos - 16, obj.yPos, 1)) {
obj.direction = obj.xSpeed = -obj.xSpeed;
}
jjDrawTile(obj.xPos - 16, obj.yPos - 16, 4);
break;
case STATE::KILL:
@exp = jjObjects[jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos, obj.objectID, CREATOR::OBJECT)];
exp.determineCurAnim(ANIM::AMMO, 5);
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_EXPL_TNT);
obj.delete();
break;
}
}
Quote:
Originally Posted by incandescentembers
Maybe I'm tripping, but doesn't the original secret level in Medivo crash in JJ2? I remember that there was something wrong with that.
|
See the Multiple Exits example level.
|