Sign in to follow this  
Fs02

Advice on Creating GTA 2 like game play

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites

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.

Edited by AngryPlatypus

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this