Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array<uint> canShootTick = {0, 0, 0, 0};
- void onPlayer() {
- if (canShootTick[p.localPlayerID] > jjGameTicks) {
- p.noFire = true;
- }
- }
- void onMain() {
- for (int i=0; i < jjObjectCount; i++) {
- if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::ELECTROBULLETPU && jjObjects[i].creatorType == CREATOR::PLAYER) {
- jjOBJ@ bullet;
- jjPLAYER@ player;
- @player = jjPlayers[jjObjects[i].creator-32768]; // HAX!! nope just signed
- @bullet = jjObjects[jjAddObject(OBJECT::LIGHTNINGSHIELDBULLET, jjObjects[i].xPos, jjObjects[i].yPos, jjObjects[i].creator, CREATOR::PLAYER)];
- bullet.creator = jjObjects[i].creator;
- bullet.xSpeed = jjObjects[i].xSpeed+player.xSpeed*3.0f;
- bullet.ySpeed = jjObjects[i].ySpeed+player.ySpeed/5.0f;
- bullet.xAcc = 0;
- bullet.determineCurAnim(ANIM::AMMO, 66); // Blade/ring sprite
- jjSample(bullet.xPos, bullet.yPos, SOUND::COMMON_RINGGUN);
- for (int j = 0; j < jjLocalPlayerCount; j++) {
- jjPLAYER@ local;
- @local = jjLocalPlayers[j];
- if (local.playerID == player.playerID) {
- //jjAlert("Player "+formatInt(j, "l")+" shot this");
- canShootTick[j] = jjGameTicks + 1*70; // Can't fire, must wait 1 second
- break;
- }
- }
- jjObjects[i].state = STATE::KILL; // Destroy the electroblaster bullet
- }
- // Steer the blade gun, play sound effects, keep it "alive"
- else if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::LIGHTNINGSHIELDBULLET && jjObjects[i].creatorType == CREATOR::PLAYER && jjObjects[i].state != STATE::KILL) {
- jjObjects[i].counter = jjGameTicks % (jjObjects[i].counterEnd/2);
- if ((jjGameTicks + jjObjects[i].age) % 20 == 0) {
- jjSample(jjObjects[i].xPos, jjObjects[i].yPos, SOUND::INTRO_SWISH2);
- }
- // This is optional, lets the player control the blade/disc
- jjObjects[i].xSpeed = jjObjects[i].xSpeed + jjPlayers[jjObjects[i].creator].xSpeed/2.0f;
- jjObjects[i].ySpeed = jjObjects[i].ySpeed + jjPlayers[jjObjects[i].creator].ySpeed/24.0f;
- jjObjects[i].xSpeed = jjObjects[i].xSpeed*1.2f;
- jjObjects[i].ySpeed = jjObjects[i].ySpeed*1.01f;
- // Max speed on the x-axiss
- if (jjObjects[i].xSpeed > 40.0f) {
- jjObjects[i].xSpeed = 40.0f;
- } else if (jjObjects[i].xSpeed < -40.0f) {
- jjObjects[i].xSpeed = -40.0f;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement