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
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
User prompt
When centering car remember that car is attached to main container
Code edit (1 edits merged)
Please save this source code
User prompt
In tick, move main container such that the car the car always stays in view
User prompt
Speed of car should be up right or up left
User prompt
Remove the game over code
User prompt
We need a container that all game elements are attached to
User prompt
Center the car at the center of the scree
Initial prompt
Car drifting game
===================================================================
--- original.js
+++ change.js
@@ -31,8 +31,9 @@
var carGlobalPosition = car.toGlobal({
x: 0,
y: 0
});
+ console.log(carGlobalPosition);
var offsetX = 2048 / 2 - carGlobalPosition.x;
var offsetY = 2732 / 2 - carGlobalPosition.y;
mainContainer.x += offsetX;
mainContainer.y += offsetY;