===================================================================
--- original.js
+++ change.js
@@ -133,12 +133,14 @@
}));
self.scale.set(Math.random() < 0.5 ? -1 : 1, 1);
;
self.update = update;
+ self.tryBonk = tryBonk;
self.slotIndex = config.slotIndex;
self.className = config.className;
self.leaderAsset = leaderAsset;
self.censorAsset = censorAsset;
+ self.points = LEADER_POINTS_TROLL;
self.bonked = false;
;
function update() {
if (countdownTime === LEADER_DURATION) {
@@ -156,15 +158,20 @@
return true;
}
}
}
- function tryBonk() {
+ function tryBonk(pointX, pointY) {
if (!self.bonked) {
- // TODO: Check if collision before performing
- scoreText.setText(++score);
- self.countdown = 0;
- self.bonked = true;
- return true;
+ var parent = self.parent;
+ var rx = TABLE_HOLE_WIDTH * 0.5;
+ var dx = pointX - GAME_WIDTH * 0.5 - parent.x;
+ var cdy = pointY - (table.y + parent.y - rx);
+ var ody = pointY - (table.y + parent.y + TABLE_HOLE_OFFSET);
+ if (pointWithinCircle(dx, cdy, rx) || pointWithinOval(dx, ody, rx, TABLE_HOLE_DEPTH * 0.5)) {
+ countdownTime = 0;
+ self.bonked = true;
+ return true;
+ }
}
}
;
return self;
@@ -216,9 +223,22 @@
return self;
});
var LeaderGreat1 = Leader.expand(function (config) {
var self = Leader.call(this, 'leaderGreat1', config);
+ var baseTryBonk = self.tryBonk;
+ self.tryBonk = tryBonk;
+ self.points = LEADER_POINTS_GREAT;
;
+ function tryBonk(x, y) {
+ if (baseTryBonk(x, y)) {
+ if (MESSAGE_WRONG.length) {
+ textbox.setText(MESSAGE_WRONG.splice(Math.floor(Math.random() * MESSAGE_WRONG.length), 1)[0]);
+ messageTimer = MESSAGE_REFRESH;
+ }
+ return true;
+ }
+ }
+ ;
return self;
});
var ImpactParticle = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -277,12 +297,8 @@
} else {
elapsedTicks = 0;
stage++;
handleImpactPoint(self.x, self.y);
- particleList.push(midground.addChild(new ImpactParticle({
- x: self.x,
- y: self.y
- })));
}
} else if (stage === 2) {
if (elapsedTicks <= PARTICLE_HAMMER_STAGE_2) {
var alpha = 1 - elapsedTicks / PARTICLE_HAMMER_STAGE_2;
@@ -553,8 +569,10 @@
// Game constants
var GAME_TICKS = 60;
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
+var GAME_COUNTDOWN = 60 * GAME_TICKS;
+var GAME_COOLDOWN = 5 * GAME_TICKS;
;
// Particle settings
var PARTICLE_HAMMER_SPIN = MATH_QUARTER_PI * 2.5;
var PARTICLE_HAMMER_STAGE_1 = Math.round(0.075 * GAME_TICKS);
@@ -563,48 +581,52 @@
var PARTICLE_HAMMER_ASSETS = 5;
var PARTICLE_HAMMER_ROTATION = MATH_QUARTER_PI;
var PARTICLE_HAMMER_SCALE_MAX = 2.0;
// Leader settings
-var LEADER_DURATION = 1 * GAME_TICKS;
+var LEADER_DURATION = Math.round(1.25 * GAME_TICKS);
var LEADER_SPAWN_MIN = 2 * GAME_TICKS;
var LEADER_SPAWN_VAR = 1 * GAME_TICKS;
-var LEADER_SPAWN_FACTOR = 0.95;
+var LEADER_SPAWN_FACTOR = 0.96;
var LEADER_SPAWN_TIME = Math.round(0.075 * GAME_TICKS);
+var LEADER_SPAWN_CUTOFF = 1 * GAME_TICKS;
+var LEADER_SPAWN_SNEAKY = 0.2;
+var LEADER_POINTS_TROLL = 1;
+var LEADER_POINTS_GREAT = -2;
// Table settings
var TABLE_WIDTH = 2500;
var TABLE_DEPTH = 1500;
var TABLE_CENTER_Y = GAME_HEIGHT / 2 + 125;
var TABLE_SLICES = 6;
var TABLE_HOLES = [1, 2, 3, 2, 1, 0];
var TABLE_HOLE_WIDTH = 334;
-var TABLE_HOLE_GAP = 778;
+var TABLE_HOLE_DEPTH = 230;
+var TABLE_HOLE_OFFSET = -83;
+var TABLE_HOLE_GAP = 776;
var TABLE_BUTTON_INDEX = 4;
-// Other settings
-var COUNTDOWN_GAME = 60 * GAME_TICKS;
-var HAMMER_RADIUS = 50;
// Messages
-var MESSAGE_REFRESH = 5 * GAME_TICKS;
+var MESSAGE_REFRESH = 9 * GAME_TICKS;
var MESSAGE_INTRO = 'Blue Lizard Entertainment proudly presents: #####Whac-a-Mo...##########\n... Whac-a-##########Politician? Are we T###R###Y###I###N###G### to get sued.########## Again?';
-var MESSAGE_START = 'And off you go... Good luck. You\'ll probably need it for this beta-mess.';
+var MESSAGE_START = 'And off you go... Good luck.##########\nYou\'ll probably need it for this messy beta game.';
var MESSAGE_WRONG = ['Apparently you shouldn\'t bonk the Kiwi.', 'This isn\'t Kiwi Clicker.'];
var MESSAGE_OUTRO = 'Well, that\'s all there is... Good job! Thanks for playing.';
var MESSAGE_EXTRA = 'That\'s a Sneaky one that... Good job! Thanks for playing.';
var MESSAGE_RANDO = [];
-MESSAGE_RANDO.push('Was this a "Bobby-proposal"?');
+MESSAGE_RANDO.push('Was this game a "Bobby-proposal"?');
MESSAGE_RANDO.push('Oh, we are S###O###O###O### getting sued for this.');
MESSAGE_RANDO.push('These people are the pinnacle leaders of humanity, surely not?');
-MESSAGE_RANDO.push('The Europeans leaders seem...########## Okay?########## For once.');
-MESSAGE_RANDO.push('This game must be divine punishment for milking a bad M###M###O### for decades.');
-MESSAGE_RANDO.push('I\'m just here as a distraction to keep you from beating the company highscores.');
-MESSAGE_RANDO.push('Let\'s play spin the bottle on which game company is halving their workforce, again.');
+MESSAGE_RANDO.push('The Europeans politicians seem...########## Okay?########## For once.');
+MESSAGE_RANDO.push('This game must be divine punishment for milking a bad M###M###O### for\nover a decade.');
+MESSAGE_RANDO.push('I\'m just here as a distraction to keep you from beating the company\nhighscores.');
+MESSAGE_RANDO.push('Let\'s play spin the bottle on which game development company is\nhalving their workforce next.');
;
//==============================================================================
// Global variables
//==============================================================================
;
var started = false;
+var ended = false;
var score = 0;
-var countdown = COUNTDOWN_GAME;
+var countdown = GAME_COUNTDOWN;
var spawnTime = LEADER_SPAWN_MIN;
var spawnTimer = spawnTime;
var messageTimer = MESSAGE_REFRESH;
var leaders = [LeaderGreat1, LeaderTroll1, LeaderTroll2, LeaderTroll3, LeaderTroll4, LeaderTroll5, LeaderTroll6];
@@ -661,14 +683,20 @@
});
;
LK.on('tick', function () {
if (started) {
- handleSpawnTimer();
- handleMessageRefresh();
- if (--countdown <= 0) {
- LK.showGameOver();
+ if (ended) {
+ if (--countdown < 0) {
+ LK.showGameOver();
+ }
+ } else {
+ handleSpawnTimer();
+ handleMessageRefresh();
+ countdownText.setText(Math.ceil(countdown / GAME_TICKS));
+ if (--countdown < 0) {
+ handleGameEnd();
+ }
}
- countdownText.setText(Math.ceil(countdown / GAME_TICKS));
for (var i = leaderList.length - 1; i >= 0; i--) {
var leader = leaderList[i];
if (leader.update()) {
table.despawn(leader.slotIndex, leader.className);
@@ -691,9 +719,9 @@
;
// Handlers
;
function handleSpawnTimer() {
- if (--spawnTimer <= 0) {
+ if (--spawnTimer <= 0 && countdown > LEADER_SPAWN_CUTOFF) {
spawnTimer += spawnTime;
spawnTime = spawnTime * LEADER_SPAWN_FACTOR;
LK.setTimeout(table.spawn, Math.random() * LEADER_SPAWN_VAR);
}
@@ -711,13 +739,41 @@
if (pointWithinOval(dx, dy, startButton.width * 0.5, startButton.height * 0.5)) {
started = true;
startButton.destroy();
startButton = undefined;
+ textbox.setText(MESSAGE_START);
+ messageTimer = MESSAGE_REFRESH;
+ particleList.push(midground.addChild(new ImpactParticle({
+ x: x,
+ y: y
+ })));
}
} else {
- // TODO: Check bonk collisions
+ for (var i = leaderList.length - 1; i >= 0; i--) {
+ var leader = leaderList[i];
+ if (leader.tryBonk(x, y)) {
+ score = Math.max(0, LK.getScore() + leader.points);
+ scoreText.setText(score);
+ LK.setScore(score);
+ particleList.push(midground.addChild(new ImpactParticle({
+ x: x,
+ y: y
+ })));
+ break;
+ }
+ }
}
}
+function handleGameEnd() {
+ ended = true;
+ countdown = GAME_COOLDOWN;
+ if (Math.random() <= LEADER_SPAWN_SNEAKY) {
+ LK.setTimeout(table.spawn, 2 * LEADER_SPAWN_VAR);
+ textbox.setText(MESSAGE_EXTRA);
+ } else {
+ textbox.setText(MESSAGE_OUTRO);
+ }
+}
;
// Library
;
function hexToHex(input) {
@@ -727,7 +783,20 @@
return '#' + input.toString(16).padStart(6, '0');
}
return input;
}
+function pointWithinCircle(dx, dy, r) {
+ if (dx >= -r && dx <= r && dy >= -r && dy <= r) {
+ // Quick rectangle-check
+ return dx * dx + dy * dy <= r * r;
+ }
+ return false;
+}
function pointWithinOval(dx, dy, rx, ry) {
- return dx * dx / (rx * rx) + dy * dy / (ry * ry) <= 1;
+ if (dx >= -rx && dx <= rx && dy >= -ry && dy <= ry) {
+ // Quick rectangle-check
+ var rx2 = rx * rx;
+ var ry2 = ry * ry;
+ return ry2 * dx * dx + rx2 * dy * dy <= ry2 * rx2;
+ }
+ return false;
}
\ No newline at end of file
logo for a company called "blue lizard entertainment" using a damaged font and frozen elements.
Pixel art of the bam symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of bam comic symbol.
pixel art of pow comic symbol.
pixel art of plastic squeaky hammer.
pixel art of a large, round, red start button.