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
Code edit (9 edits merged)
Please save this source code
User prompt
plese make the game.up function detect swipes in three directions, either primarily up,primarily down or primarily right
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
every 30 tiks, spawn a new collectible at random y position and x above 2048, and move it onto the screen
Code edit (10 edits merged)
Please save this source code
User prompt
make a class for a collectible object that is assigned a random asset: snacks, snacks2,snacks3, snacks4, snacks5, snacks6, or snacks7
Code edit (5 edits merged)
Please save this source code
User prompt
use player velocityY to make hm jump
Code edit (1 edits merged)
Please save this source code
User prompt
mak the player bob and bump continously to simulate a kind of stick-doll walkcycle animation
User prompt
use two instances of path for seamless scrolling
User prompt
make a parallax effect where the path and the bushes move slowly towards the left, as new instances are spawned on the right side seamlessly
User prompt
make another asset called berrybush, and use it randomly for shrubbery
Code edit (2 edits merged)
Please save this source code
User prompt
add a bit of randomness to the shrubberies x and y positions
Code edit (9 edits merged)
Please save this source code
User prompt
make a function to place x amount of shrubberies, more or less evenly spaced
User prompt
add a few shrubberies between the background and ground
Code edit (4 edits merged)
Please save this source code
User prompt
make a path asset
===================================================================
--- original.js
+++ change.js
@@ -43,9 +43,9 @@
alpha: 0
});
self.playerDuckGraphics = self.attachAsset('playerDuck', {
anchorX: 0.5,
- anchorY: 0.5,
+ anchorY: 0.3,
alpha: 0
});
self.playerDashGraphics = self.attachAsset('playerDash', {
anchorX: 0.5,
@@ -57,19 +57,19 @@
self.jumping = false;
self.dashing = false;
self.ducking = false;
self.actionTimer = 0;
- self.actionTimerMax = 180;
+ self.actionTimerMax = 90;
self.update = function () {
if (gameStarted) {
if (self.jumping) {
// Update position based on velocityY
self.y -= self.velocityY;
// Apply gravity
self.velocityY -= 1;
// Prevent player from falling below the ground
- if (self.y > 2732 - 510) {
- self.y = 2732 - 510;
+ if (self.y > 2732 - 490) {
+ self.y = 2732 - 490;
self.velocityY = 0;
self.jumping = false;
self.playerWalkGraphics.alpha = 1;
self.playerJumpGraphics.alpha = 0;
@@ -80,16 +80,18 @@
self.dashing = false;
self.playerWalkGraphics.alpha = 1;
self.playerDashGraphics.alpha = 0;
self.actionTimer = 0;
+ gameSpeedBoost = 0;
}
} else if (self.ducking) {
self.actionTimer++;
if (self.actionTimer >= self.actionTimerMax) {
- self.dashing = false;
+ self.ducking = false;
self.playerWalkGraphics.alpha = 1;
self.playerDuckGraphics.alpha = 0;
self.actionTimer = 0;
+ gameSpeedBoost = 0;
}
}
// Just walking
if (!self.jumping && !self.dashing && !self.ducking) {
@@ -100,8 +102,9 @@
}
};
self.jump = function () {
if (!self.jumping) {
+ self.velocityY = 50;
self.jumping = true;
self.playerWalkGraphics.alpha = 0;
self.playerDashGraphics.alpha = 0;
self.playerJumpGraphics.alpha = 1;
@@ -109,8 +112,9 @@
}
};
self.dash = function () {
if (!self.dashing) {
+ gameSpeedBoost = defaultBoostAmount;
self.dashing = true;
self.playerWalkGraphics.alpha = 0;
self.playerDashGraphics.alpha = 1;
self.playerJumpGraphics.alpha = 0;
@@ -118,8 +122,9 @@
}
};
self.duck = function () {
if (!self.ducking) {
+ gameSpeedBoost = defaultBoostAmount;
self.ducking = true;
self.playerWalkGraphics.alpha = 0;
self.playerDashGraphics.alpha = 0;
self.playerJumpGraphics.alpha = 0;
@@ -149,8 +154,17 @@
/****
* Game Code
****/
+var gameStarted = false;
+var obstacles = [];
+var colectibles = [];
+var gameSpeed = 4;
+var gameSpeedBoost = 0;
+var defaultBoostAmount = 20;
+var touchStartX = 0;
+var touchStartY = 0;
+var groundY = 2732 - 510;
// Add background image
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
@@ -162,40 +176,39 @@
var path1 = LK.getAsset('path', {
anchorX: 0,
anchorY: 0,
x: 0,
- y: 2732 - 400
+ //y: 2732 - 400
+ y: groundY - 110
});
game.addChild(path1);
// Add second path image
var path2 = LK.getAsset('path', {
anchorX: 0,
anchorY: 0,
x: 2048,
- y: 2732 - 400
+ //y: 2732 - 400
+ y: groundY - 110
});
game.addChild(path2);
// Function to place x amount of shrubberies evenly spaced
function placeShrubberies(count) {
var spacing = 4096 / (count + 1);
for (var i = 1; i <= count; i++) {
var shrubbery = new Shrubbery();
shrubbery.x = spacing * i + (Math.random() * 100 - 50); // Add randomness to x position
- shrubbery.y = 2732 - 350 + (Math.random() * 30 - 15); // Add randomness to y position
+ shrubbery.y = groundY - 160 + (Math.random() * 30 - 15); // Add randomness to y position
game.addChild(shrubbery);
}
}
// Place 5 shrubberies as an example
placeShrubberies(16);
// Initialize player
var player = new Player();
player.x = 350;
-player.y = 2732 - 510;
+//player.y = 2732 - 510;
+player.y = groundY; //2732 - 510;
game.addChild(player);
-// Array to keep track of obstacles
-var obstacles = [];
-var colectibles = [];
-var gameSpeed = 2;
// Function to spawn obstacles
function spawnObstacle() {
var obstacle = new Obstacle();
obstacle.x = Math.random() * 4096;
@@ -208,16 +221,14 @@
if (!gameStarted) {
gameStarted = true;
}
//player.velocityY = 50;
+ touchStartX = x;
+ touchStartY = y;
};
game.up = function (x, y, obj) {
- var startX = obj.event && obj.event.data ? obj.event.data.global.x : 0;
- var startY = obj.event && obj.event.data ? obj.event.data.global.y : 0;
- var endX = x;
- var endY = y;
- var deltaX = endX - startX;
- var deltaY = endY - startY;
+ var deltaX = x - touchStartX;
+ var deltaY = y - touchStartY;
if (Math.abs(deltaX) > Math.abs(deltaY)) {
if (deltaX > 0) {
console.log("Swipe Right");
// Add logic for right swipe
@@ -234,17 +245,16 @@
player.jump();
}
}
};
-var gameStarted = false;
// Update game logic
game.update = function () {
if (gameStarted) {
// Update player
player.update();
// Move paths to the left
- path1.x -= 2;
- path2.x -= 2;
+ path1.x -= gameSpeed + gameSpeedBoost;
+ path2.x -= gameSpeed + gameSpeedBoost;
// Reset path positions for seamless scrolling
if (path1.x <= -2048) {
path1.x = path2.x + 2048;
}
@@ -254,9 +264,9 @@
// Move shrubberies to the left
for (var i = game.children.length - 1; i >= 0; i--) {
var child = game.children[i];
if (child instanceof Shrubbery || child instanceof Collectible) {
- child.x -= gameSpeed + child.speed;
+ child.x -= gameSpeed + gameSpeedBoost + child.speed;
if (child.x <= -child.width) {
child.x = 2048 + child.width;
}
}
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.