User prompt
Momentum modifier should be different for X and Y, such that you loose speed faster in the direction the car is not traveling
User prompt
decrease offset x y divider to 5
User prompt
Update car logic such that it has momentum. With speed being a modifier to momentum
User prompt
add 20px randomly to x and y of particle when spawning them
User prompt
Spawn particles below the car with a random 50px offset on both x and y
User prompt
When changing direction in car, flip the x scale of carGraphics
User prompt
set game background color to c39977
User prompt
Make particle lifetime be 200
User prompt
in tick use adChildAt to add the particles to z-index zero
User prompt
Divide offsetX and offsetY in tick by 50
User prompt
Keep track of particle in game, and remember to tick them
User prompt
add particles to mainContainer
User prompt
Replace the tick handler in particle with a tick method that is called from game
User prompt
In game tick, leave particles below the car
Code edit (9 edits merged)
Please save this source code
User prompt
use self.toLocal to get the offset of the car
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Instead of point use {x:0,y:0}
User prompt
Fix Bug: 'TypeError: car.getGlobalPosition is not a function. (In 'car.getGlobalPosition()', 'car.getGlobalPosition' is undefined)' in this line: 'var carGlobalPosition = car.getGlobalPosition();' Line Number: 31
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: undefined is not a constructor (evaluating 'new Point()')' in this line: 'var carGlobalPosition = car.toGlobal(new Point());' Line Number: 31
User prompt
Fix Bug: 'TypeError: undefined is not a constructor (evaluating 'new Point()')' in this line: 'var carGlobalPosition = car.toGlobal(new Point());' Line Number: 31
User prompt
Fix Bug: 'TypeError: undefined is not a constructor (evaluating 'new Point()')' in this line: 'var carGlobalPosition = car.toGlobal(new Point());' Line Number: 31
User prompt
Fix Bug: 'TypeError: undefined is not a constructor (evaluating 'new Point()')' in this line: 'var carGlobalPosition = car.toGlobal(new Point());' Line Number: 31
===================================================================
--- original.js
+++ change.js
@@ -16,15 +16,16 @@
x: 0,
y: 0
};
self.move = function () {
- var momentumModifier = 0.1;
+ var momentumModifierX = 0.05;
+ var momentumModifierY = 0.1;
if (self.direction === 0) {
- self.momentum.x += self.speed * momentumModifier;
- self.momentum.y -= self.speed * momentumModifier;
+ self.momentum.x += self.speed * momentumModifierX;
+ self.momentum.y -= self.speed * momentumModifierY;
} else {
- self.momentum.x -= self.speed * momentumModifier;
- self.momentum.y -= self.speed * momentumModifier;
+ self.momentum.x -= self.speed * momentumModifierY;
+ self.momentum.y -= self.speed * momentumModifierX;
}
self.x += self.momentum.x;
self.y += self.momentum.y;
self.momentum.x *= 0.98;