I have 2d game with about 8 cars I want all of them to have cameras so they drive smoothly but i can’t because the camera focus on another the car that Am not driving Why is that?
Did you mean 8 players on one screen? Or are you meaning a multiplayer networked game, with each player on their own device?
If multiplayer, have a read of the multiplayer documentation in the GDevelop Wiki.
no i am making a 2d GTA style game with 8 cars 1 camera for each car
Networked or on one screen?
i am not making a multi player game yet
You’ll need to explain it a bit better. One player, 8 cars? Who’s running those cars? AI?
And do you want all the cars followed on one screen? Are all the cars in the game scene at the same time? Or do you want the player to be able to switch between cars?
i am using path findind for my cars
I can’t help if you don’t provide more information. Is the screen broken into 8 areas, one for each car? Do you switch between cars and want the camera to follow the one in focus?
If you can’t explain how the game, cars and cameras work, then I can’t help because I don’t understand what you are after.
Why delete the previous post? This is my response to it:
Don’t use a camera per car. Use one camera (camera 0 is easiest as it’s the default), and move that to the current car.
You can do this a number of ways:
-
Use a boolean:
Add a boolean variable say called “isCurrent” to each car and set it to false. When you change focus on a car, set the boolean variable to false on the previous car, and set it to true for the current car.
When you move the camera, focus it on the car that has the variable “isCurrent” set to true. -
Use a camera focus object with sticker behaviour:
Create a small sprite, hide it and position it at the centre of the car that has focus. Stick the hidden object to the car. Position the camera on this sprite. When you change cars, unstick the hidden object, then move and stick it onto the current car.
As a suggestion, #2 is the easier of the two options.
Post if you need help implementing whichever one you choose.
my game work like this you walk around the main camera follow Andre johnson when you get in to a car and press RT Let stick,right stick, up.down LT the camera changes to a car not the car i am driving
I’m not clear on what is meant by this. Is it some combo to get into the car?
If we are to help, you’ll need to provide screen shots of your events that deal with getting into the car and setting camera focus on the car.
I can’t help unless you provide the relevant screen.
need help with the (use a Boolean) I tried but I could not do it what do I ?
Can you screen shot the events using the boolean?
Are the cars all different objects? If so, do the following:
- Create an object group named “
CarGroup
”, and to it add a group variable “isCurrent
”. This will add the variable to all the car obejcts in the group. - You can simplify those events in your screen shot so they’ll apply to any car:
(the first subevent will set isCurrent to false for all cars. The second subevent is only applied to the car selected in the parent event - the first subevent’s conditions don’t apply to the second subevent) - Centre the camera with:
thanks for the help i will try it out
D Light