class vector2i { int x, y; } array oneWays; void onLevelLoad() { jjOBJ@ obj = jjObjectPresets[OBJECT::BOUNCERBULLETPU]; obj.behavior = OrangeGun; obj.special = obj.determineCurAnim(ANIM::PICKUPS, 71); obj.killAnim = jjObjectPresets[OBJECT::SEEKERBULLET].killAnim; obj.var[6] = 0; jjObjects[0].determineCurAnim(ANIM::WARP20, 0, false); } void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ layer) { layer.drawSprite(26*32, 7*32, ANIM::WARP20, 0, jjGameTicks >> 3); } void OrangeGun(jjOBJ@ obj) { obj.behave(BEHAVIOR::BOUNCERBULLETPU, false); jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction * obj.counter << 4); if (obj.state != STATE::EXPLODE && (jjMaskedPixel(int(obj.xPos) + int(obj.xSpeed), int(obj.yPos)) || jjMaskedPixel(int(obj.xPos) - int(obj.xSpeed), int(obj.yPos)) || jjMaskedPixel(int(obj.xPos), int(obj.yPos) + 8 + int(obj.ySpeed)) || jjMaskedPixel(int(obj.xPos), int(obj.yPos) - int(obj.ySpeed))) && jjEventAtLastMaskedPixel != AREA::VINE) { if (jjSoundEnabled) jjSample(obj.xPos, obj.yPos, SOUND::MONKEY_SPLUT, 0, 0); obj.state = STATE::EXPLODE; } } void onPlayer(jjPLAYER@ play) { play.powerup[WEAPON::BOUNCER] = true; play.currWeapon = WEAPON::BOUNCER; play.noFire = play.ammo[WEAPON::BOUNCER] == 0; if (play.charCurr == CHAR::JAZZ) { if (play.specialMove > 0) { if (play.specialMove < 14) play.specialMove = 14; play.ySpeed = -8; } } for (uint i = 0; i < oneWays.length(); i++) { jjEventSet(oneWays[i].x, oneWays[i].y, AREA::ONEWAY); } oneWays.resize(0); int px = int(play.xPos), py = int(play.yPos); bool masked; for (int i = -11 + int(play.ySpeed); i <= 14; i++) { if (masked = jjMaskedHLine(px - 14, 28, py + i)) break; } if (!masked) { for (int i = 8; i <= 16; i += 8) { for (int j = 12; j <= 20; j += 8) { int x = (px + play.direction * j) >>> 5, y = (py + i) >>> 5; if (x >= 0 && y >= 0 && x < jjLayerWidth[4] && y < jjLayerHeight[4] && jjEventGet(x, y) == AREA::ONEWAY) { vector2i point; jjEventSet(point.x = x, point.y = y, 0); oneWays.insertLast(point); } } } } } void onFunction1(jjPLAYER@ play) { if (play.testForCoins(20)) { play.ammo[WEAPON::BOUNCER] = play.ammo[WEAPON::BOUNCER] + 10; jjSamplePriority(SOUND::MENUSOUNDS_TYPEENTER); } } bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) { if (!play.noFire) { canvas.drawSprite( jjSubscreenWidth - 90, jjSubscreenHeight - 14, ANIM::PICKUPS, 71, 0, SPRITE::NORMAL ); canvas.drawString( jjSubscreenWidth - 80, jjSubscreenHeight - 14, "x" + play.ammo[WEAPON::BOUNCER], STRING::MEDIUM, STRING::NORMAL ); return true; } return false; }