Hi, I am creating a game like monster truck, I can make a car with motor and move it around using it wheels and setMotorSpeed(), however I don't know how to lock it in center of screen camera.
I tried move the scene when my car went out of it locking position, however with setMotorSpeed() the car seems sliding and the scene move too fast. Of course I already set a friction value and car won't slide in normal scene (no camera)
Any help would be very appreciated!!!
Comments
https://github.com/nshafer/KineticZoomCamera/blob/master/Camera.lua
Just add all of your sprites as a child of the camera, including your backgrounds, ground, car, etc. Then you can call camera:centerPoint() with the x and y of the car, and it will always be in the center.
You will probably want to remove the touch events so that the camera only ever follows the car.
Thanks,
Nathan Shafer
Likes: phongtt
Likes: hgvyas123
Ultimate Games on Appstore
Ultimate Games on Google Play
p/s: That's why I love Gideros forum. Stuck on something? Just ask, and sure your problem will be solved.
Likes: fxone, vitalitymobile
Ultimate Games on Appstore
Ultimate Games on Google Play
Niicodemus, I'm having a play around with your Camera class. It works very well and I find your code nice and clean - easy to read.
I'm attempting to use your Camera class to move around a physics based game I'm working on, the problem is, the Camera class moves the sprites around, but the physical bodies aren't affected. How could this be overcome using your class?
Thanks!
I think you could do the following, if I have understood well your question:
Camera Class has a function Camera:centerPoint(x, y)
You use this function over main sprite to update its position.
I hope I've helped you
[-] Liasoft