Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'barricade.x = 2048 + spikeTrap.width;' Line Number: 454
Code edit (1 edits merged)
Please save this source code
User prompt
give all text a black outline
User prompt
the +10 signs should fly off to the left side of the screen and be destroyed after a few seconds
User prompt
show a +10 sign and play a sound effect when player picks up a collectible
User prompt
Increase score by 10 when player picks up a collectible
User prompt
add a scorelabel top center of the scree
Code edit (12 edits merged)
Please save this source code
User prompt
make a class for the dustparticle and use its update method instead of running the spread and alpha in an interval
User prompt
the dust particles should spread and go transparent before they disappear
User prompt
use a separate dustparticle asset for the dustparticles
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'destroy')' in or related to this line: 'particle.destroy();' Line Number: 169
User prompt
the dustparticle effect should be a small aprticle explosion looking like dust that rises from the ground on jump takeoff and landing
User prompt
make a dustparticle effect when player jumps and lands
Code edit (1 edits merged)
Please save this source code
User prompt
every five seconds, spawn a spiketrap off the right side of the screen, at groundY and bring it onto the screen at gamespeed + boostspeed
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'data')' in or related to this line: 'var startX = obj.event.data.global.x;' Line Number: 236
===================================================================
--- original.js
+++ change.js
@@ -2,17 +2,14 @@
* Classes
****/
/***
TODO:
- - Pause to explain the jump, dash and duck mechanics first time corresponding obstacles appear.
+ - Add game logo in right corner for game/brand awareness building.
+ - Add dust from walking.
- Music
- Sound effects
- - Difficulty ramping.
- - Make sure collectibles aren't moved to right side on exit, but destroyed.
- - Consider higher score for higher flying collectibles, maybe also make each fly at specific height,
- and the valuable ones rarer. Or maybe unavailable at first.
- Title, description, hashtags, icon and banner image. Måske Endless Dwarven Run i stedet for Viking.
- */
+ */
var ArrowVolley = Container.expand(function () {
var self = Container.call(this);
//var assetTypes = ['snacks', 'snacks2', 'snacks3', 'snacks4', 'snacks5', 'snacks6', 'snacks7'];
//var randomAsset = assetTypes[Math.floor(Math.random() * assetTypes.length)];
@@ -268,12 +265,12 @@
});
var ScoreSign = Container.expand(function (scoreAmount) {
var self = Container.call(this);
var scoreSignGraphics = new Text2('+' + scoreAmount, {
- size: 100,
+ size: 120,
fill: "#ffffff",
stroke: "#000000",
- strokeThickness: 5
+ strokeThickness: 8
});
scoreSignGraphics.anchor.set(0.5, 0.5);
self.addChild(scoreSignGraphics);
self.speedX = -5;
@@ -339,26 +336,37 @@
/****
* Game Code
****/
// Create and add score label to the top center of the screen
-var scoreLabel = new Text2('Score: 0', {
- size: 100,
+var scoreLabel = new Text2('0', {
+ size: 120,
fill: "#ffffff",
stroke: "#000000",
- strokeThickness: 5
+ strokeThickness: 8
});
scoreLabel.anchor.set(0.5, 0); // Center the score label horizontally
LK.gui.top.addChild(scoreLabel);
var gameStarted = false;
var gameOver = false;
+var gamePaused = false;
var obstacles = [];
var colectibles = [];
var gameSpeed = 20;
var gameSpeedBoost = 0;
var defaultBoostAmount = 10;
var touchStartX = 0;
var touchStartY = 0;
var groundY = 2200; //1810; //2732 - 510;
+var ARROWS_SEEN = false;
+var PALLISADES_SEEN = false;
+var SPIKETRAP_SEEN = false;
+var instructionsLabel = new Text2('', {
+ size: 120,
+ fill: "#ffffff",
+ stroke: "#000000",
+ strokeThickness: 8,
+ align: 'center'
+});
// Add background image
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
@@ -417,8 +425,34 @@
gameOver = true;
}
}
;
+function pauseAndShowInstructions(type) {
+ LK.setTimeout(function () {
+ // Your function code here
+ gamePaused = true;
+ /*var label = new Text2('0', {
+ size: 120,
+ fill: "#ffffff",
+ stroke: "#000000",
+ strokeThickness: 8,
+ align: 'center'
+ });*/
+ var label = instructionsLabel;
+ label.anchor.set(0.5, 0.5);
+ label.x = 2048 / 2;
+ label.y = 2832 / 2;
+ if (type == 1) {
+ label.setText('SWIPE UP\nTO JUMP OVER THE SPIKES');
+ } else if (type == 2) {
+ label.setText('SWIPE FORWARD\nTO BASH THROUGH THE BARICADES');
+ } else if (type == 3) {
+ label.setText('SWIPE DOWN\nTO DUCK THE ARROWS');
+ }
+ game.addChild(label);
+ }, 1000);
+}
+;
// Handle touch events for player movement
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
@@ -427,8 +461,12 @@
touchStartX = x;
touchStartY = y;
};
game.up = function (x, y, obj) {
+ if (gamePaused) {
+ gamePaused = false;
+ game.removeChild(instructionsLabel);
+ }
var deltaX = x - touchStartX;
var deltaY = y - touchStartY;
if (Math.abs(deltaX) > Math.abs(deltaY)) {
if (deltaX > 0) {
@@ -449,8 +487,11 @@
}
};
// Update game logic
game.update = function () {
+ if (gamePaused) {
+ return;
+ }
if (gameOver == true) {
player.update();
}
if (gameStarted && !gameOver) {
@@ -485,9 +526,10 @@
}
} else if (child instanceof Collectible) {
child.x -= gameSpeed + gameSpeedBoost + child.speed;
if (child.x <= -child.width) {
- child.x = 2048 + child.width;
+ //child.x = 2048 + child.width;
+ child.destroy();
}
if (child.intersects(player)) {
LK.setScore(LK.getScore() + child.scoreVal);
scoreLabel.setText('' + LK.getScore());
@@ -559,20 +601,35 @@
spikeTrap.x = 2048 + spikeTrap.width;
spikeTrap.y = groundY;
game.addChild(spikeTrap);
obstacles.push(spikeTrap);
+ if (!SPIKETRAP_SEEN) {
+ // plan delay to show swipe movement
+ pauseAndShowInstructions(1);
+ SPIKETRAP_SEEN = true;
+ }
} else if (ran < 0.66) {
var barricade = new TallBarricade();
barricade.x = 2048 + barricade.width;
barricade.y = groundY - barricade.height / 2 + 450;
game.addChild(barricade);
obstacles.push(barricade);
+ if (!PALLISADES_SEEN) {
+ // plan delay to show swipe movement
+ pauseAndShowInstructions(2);
+ PALLISADES_SEEN = true;
+ }
} else {
var volley = new ArrowVolley();
volley.x = 2048 + volley.width;
volley.y = 0;
game.addChild(volley);
obstacles.push(volley);
+ if (!ARROWS_SEEN) {
+ // plan delay to show swipe movement
+ pauseAndShowInstructions(3);
+ ARROWS_SEEN = true;
+ }
}
}
// Spawn new collectible every 30 ticks
if (LK.ticks % 40 == 0) {
@@ -581,6 +638,14 @@
//collectible.y = 300 + Math.random() * (2032 - collectible.height);
collectible.y = 2250 - collectible.rand * 300; // + Math.random() * (2032 - collectible.height);
game.addChild(collectible);
}
+ if (LK.ticks % 600 == 0) {
+ gameSpeed += 2;
+ /*var scoreSign = new ScoreSign('SPEED');
+ scoreSign.x = 2048 / 2;
+ scoreSign.y = 2732 / 2;
+ game.addChild(scoreSign);
+ */
+ }
} // endif gameStarted
};
\ No newline at end of file
A background illstration for a game, rich in style, medieval fantasy themed, of a landscape seen from a great distance, like froma mountain ridge with mountains and forests and lakes and lots of features.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A spritesheet with various poses for a heavily armored little dwarven warrior with an axe in various poses for use in an endless runner game. Te poses should include walking, eating, jumping, ducking low, and chargingforward. Sprites should be laid out in a rectangular grid wih blank space between them. Style should be medieval fantasy.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A game logo for a game called 'Endless Viking Run' using norse font on a background of a viking shield and crossed axes. Muted colors.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.