How to instantiate a selected object ?

  • Hi,

    I'm working on a physics based side scroller car game. I have made a screen to select a car when clicked on one. In the gameplay screen I have assembled all the cars by attaching wheels to the body using joints. But I do not understand how to instantiate the chosen car at the right place inside the gameplay screen. How do I go about this ?

    Thank you.

  • I think you can do this with pinning and turrets. The idea of a turret is something like a tank with a turret, but each of your parts could be a 'turret'. Dependent on exactly how C2 handles offset pin rotation, you may have to pad it out a bit.

    If you think of a stack of cards which are mostly transparent, each card having one piece, all rotating around the centre point you might get the idea I mean

  • I think you can do this with pinning and turrets. The idea of a turret is something like a tank with a turret, but each of your parts could be a 'turret'. Dependent on exactly how C2 handles offset pin rotation, you may have to pad it out a bit.

    If you think of a stack of cards which are mostly transparent, each card having one piece, all rotating around the centre point you might get the idea I mean

    Actually I have assembled the cars using revolute joints. Now all the cars are inside the gameplay screen. I just want to keep only the one I chose from the car selection menu and set its position to the right place in the track. I created a container which contains car body and wheels. But when I set the position of the car body the joints and wheels are misplaced. That's the issue I'm having. Is the a way I can change the position of a group of object which are connected using joints ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Not an expert on joints, never used them. They're supposed to rotate though aren't they according to the forces ? I thought by using a turret system or taking control yourself with a bit of trigonometry then they will be stiff ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)