User prompt
in player add the player2 asset and swap between the 2 to make a frame animation
Code edit (2 edits merged)
Please save this source code
User prompt
add a background asset
User prompt
Please fix the bug: 'Uncaught TypeError: setInterval is not a function' in or related to this line: 'var moveInterval = setInterval(function () {' Line Number: 70
User prompt
Please fix the bug: 'Uncaught TypeError: setInterval is not a function' in or related to this line: 'var moveInterval = setInterval(function () {' Line Number: 70
Code edit (1 edits merged)
Please save this source code
User prompt
make the player the move progressive
User prompt
player must move the the next path progressively
Code edit (2 edits merged)
Please save this source code
User prompt
don't use move event but tap event : when tapping left move to the path at the left and when tapping right to the path at the right
User prompt
Please fix the bug: 'Uncaught ReferenceError: playerPositions is not defined' in or related to this line: 'var nearestPosition = playerPositions.reduce(function (prev, curr) {' Line Number: 61
User prompt
it's a classical endless runner with 3 paths so don't move player with the mouse but use 3 fixed x positions left, center and right
Code edit (1 edits merged)
Please save this source code
User prompt
don't spawn all coins in one time
Code edit (1 edits merged)
Please save this source code
User prompt
add a pooling system for coins
Code edit (1 edits merged)
Please save this source code
User prompt
add initialization code in gameInitialize, don't forget to let variables in global scope
User prompt
add an mpty gameInitialize function
Initial prompt
Greedy Runner
===================================================================
--- original.js
+++ change.js
@@ -11,11 +11,15 @@
});
self.update = function () {
self.y += 5; // Move coin downwards
if (self.y > 2732) {
- self.destroy();
+ self.reset();
}
};
+ self.reset = function () {
+ self.y = -50;
+ self.x = Math.random() * 2048;
+ };
});
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
@@ -50,31 +54,28 @@
player.move(x, y, obj);
};
// Update game every tick
game.update = function () {
- // Create new coins
- if (LK.ticks % 60 == 0) {
- var newCoin = new Coin();
- newCoin.x = Math.random() * 2048;
- newCoin.y = -50;
- coins.push(newCoin);
- game.addChild(newCoin);
- }
// Update coins and check for collisions
for (var i = coins.length - 1; i >= 0; i--) {
coins[i].update();
if (player.intersects(coins[i])) {
score += 1;
scoreTxt.setText(score);
- coins[i].destroy();
- coins.splice(i, 1);
+ coins[i].reset();
}
}
};
// Initialize game
function gameInitialize() {
// Initialize arrays and variables
coins = [];
+ for (var i = 0; i < 20; i++) {
+ var newCoin = new Coin();
+ newCoin.reset();
+ coins.push(newCoin);
+ game.addChild(newCoin);
+ }
score = 0;
scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
Directly overhead, plumb view of a beggar heading top (we see his back).. Zenith view, directly overhead, plumb view. NOT PERSPECTIVE! Fantasy theme. Pixel art
a traffic cone. video game sprite
face view of a big start button in the shape of a dollar bill. video game style
a tree. video game style
a black garbage bag. video game style
Dollar bill. Perspective. video game sprite
perspective of a simple snake rolled up on itself.. video game sprite
Ball of dry desert bushes. video game sprite
tractor. high definition video game sprite
street ad billboard with 1 or 2 posts with "Get rich!" on it. high definition video game sprite
a dog sleeping on a street. video game sprite
desert bush. video game sprite
profile view of an empty motorcycle helmet. black with a white vertical central band and another thiner orange band on the center. NOT PERSPECTIVE!. Pixel art high definition
simple red and white magnet. video game style
gold sign with a "X" and a "2". video game style
bgMusic
Music
coin_1
Sound effect
hit_1
Sound effect
hit_2
Sound effect
hit_3
Sound effect
levelWin_1
Sound effect
car_1
Sound effect
police_1
Sound effect
ambulance_1
Sound effect
accident_1
Sound effect
killed_1
Sound effect
jump_1
Sound effect
rip_1
Sound effect
bonus_take
Sound effect
bonus_approaching
Sound effect