Advice on Creating GTA 2 like game play

Started by
1 comment, last by Fs02 11 years, 2 months ago

Hi, i'm prototyping a 2d top down game with a similiar game play like the old gta 2 game.

my aim now is to make my character can ride any vehicles and i need some advice how to make it

here is what i think :

- i'll make a class thats can store a pointer to any object it's being controlled in void variable than cast it to original object to gain access to it's member function ( very doubt here).

- since in box2d we can't temporary hide physics body from world(tell me if you know how :) ) i'll delete my character when it's ride any vehicles and recreate it when it's no more riding its vehicle.

please tell me what do you think, thanks :)

PS : Sorry for my bad english :)

Advertisement

Hi there,

1. i don't like a void pointer here. For me void means it can be pretty much everything. But your character shall only drive vehicles and not buildings or other characters right? Why not use a base class like "Drivable" or "Vehicle" i.e. use Polymorphism here?

2. body->SetActive(false) should do it.

1. i don't like a void pointer here. For me void means it can be pretty much everything. But your character shall only drive vehicles and not buildings or other characters right? Why not use a base class like "Drivable" or "Vehicle" i.e. use Polymorphism here?

yes void is not a good solution and thanks for pointing polymorphism because i don't even think about it since i'm not realy understand what it is for, but after some research on google i found that's very useful technique :)

2. body->SetActive(false) should do it.

again thanks, it's work perfectly :)

This topic is closed to new replies.

Advertisement