Sign in to follow this  

Moving object on a path

This topic is 1959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want my objects to move along a path, reach a coord then move back again. 3D.
[img]http://s13.postimage.org/4udr9aspj/wantiwant.jpg[/img]

I have the objects (balls in my case) in its own class, rendering the movement happens in the renderscene method in the main.cpp.

I want each ball I create to be able to set up its own path in the game.

At the moment I created a method that allows all balls to move, but I need a method for each ball to have its own path.

void Balls::Move() {
if(end){
position.x += 2;
if(position.x > 2400) {
reversed = false;
}
}

if(!end){
position.x -= 2;
if(position.x < -2400) {
reversed = true;
}
}
}

My code is in the pastebin link - [url="http://pastebin.com/wVVy7fgw"]http://pastebin.com/wVVy7fgw[/url]
The DrawBalls() method is called in the renderscene method. Edited by Tonious

Share this post


Link to post
Share on other sites

This topic is 1959 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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