Moving object on a path

Started by
0 comments, last by dpadam450 11 years, 8 months ago
I want my objects to move along a path, reach a coord then move back again. 3D.
wantiwant.jpg

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 - http://pastebin.com/wVVy7fgw
The DrawBalls() method is called in the renderscene method.
Advertisement
position.x += direction.x;

if(direction > value)
{
direction.x *= -1;
}

?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement