User prompt
make the wheel rotate slower by a factor of 0.5
User prompt
make the bus rotate slower than the wheel
User prompt
make the steering wheels rotation be determined by the cursors x position
User prompt
make the bus rotation speed relative to the movement speed
User prompt
change the rotation of the bus to only happen whenever it is also moving
User prompt
make the steering wheels rotation be determined by the cursors x position
User prompt
make the bus collide with the border of the screen
User prompt
use the vector between the cursor and the steering wheels center as a rotation vector for the wheel
User prompt
make the steering wheel only move by 90 degrees in both directions
User prompt
fix the steering wheels rotation. it should look at the cursor from its center
Code edit (1 edits merged)
Please save this source code
User prompt
make the bus accelerate when i click on the screen and stop when i release the mouse button
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'var angle = Math.atan2(mousePos.y - self.y, mousePos.x - self.x);' Line Number: 8
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getGlobalPosition')' in this line: 'var mousePos = LK.stage.toLocal(LK.Pointer.getGlobalPosition(), self);' Line Number: 7
User prompt
Fix Bug: 'TypeError: LK.stage.getPointerPosition is not a function' in this line: 'var mousePos = LK.stage.toLocal(LK.stage.getPointerPosition(), self);' Line Number: 7
User prompt
Fix Bug: 'TypeError: LK.stage.getMousePosition is not a function' in this line: 'var mousePos = LK.stage.getMousePosition();' Line Number: 7
User prompt
the steering wheel rotation should look at the cursor all times
User prompt
rotate the bus -90 degrees clockwise
User prompt
make the bus rotate in the driving direction
User prompt
a wheel at the bottom that can be controlled unsing the cursor
Initial prompt
Bus Simulator
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,9 @@
self.interactive = true;
self.on('move', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self.parent);
- self.rotation = (pos.x - self.x) / self.width * Math.PI * 2;
+ self.rotation = (pos.x - self.x) / self.width * Math.PI;
});
});
var Bus = Container.expand(function () {
var self = Container.call(this);
@@ -31,9 +31,9 @@
var deltaX = Math.cos(wheelRotation) * self.speed;
var deltaY = Math.sin(wheelRotation) * self.speed;
self.x += deltaX;
self.y += deltaY;
- self.rotation = (wheelRotation - Math.PI / 2) * 0.5;
+ self.rotation = wheelRotation - Math.PI / 2;
};
self.checkCollision = function () {};
});
var Passenger = Container.expand(function () {
Simple Car Steering Wheel. In-Game asset. 2d. Blank background. Svg
bomb Single Game Texture. In-Game asset. 2d. No shadows. flat. detailed
yellow bus stop symbol svg Single Game Texture. In-Game asset. 2d. No shadows. flat. detailed
yellow bus symbol svg. roof. top down. Single Game Texture. In-Game asset. 2d. No shadows. flat. detailed
dark transparent dust particle Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.