Car (Sprite) follows (or moves on) the way (path)?

Anything libgdx related goes here!

Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Thu Jan 31, 2013 2:33 pm

Hi.

The first thing I want to say is, that I searched the web for this solution, but I found nothing that is good, that can I use.
Maybe I searched with wrong keywords.

On the image you can see a car and a way. I will now, that the car (sprite) follows (or moves on) this way (path).
I made this "way" with Inkscape. I can save the "way" as .svg to get the path.
The car is following the path and changing his direction.

Image

for example the .svg file:
Code: Select all
...
<path
   style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
   d="m 196.47467,414.45085 ... etc."
   id="path2985"
   inkscape:connector-curvature="0" />
...


Has someone a good solution for that?
What are the good keywords for that?

Thank you.
Last edited by gameZero on Fri Feb 08, 2013 7:51 am, edited 1 time in total.
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby just4phil » Thu Jan 31, 2013 3:38 pm

hi
check the following link and ask the developer of that great game (i play it all day long :)

http://www.badlogicgames.com/forum/viewtopic.php?f=16&t=7334

cu
phil
just4phil
 
Posts: 804
Joined: Fri Feb 03, 2012 10:07 pm
Location: Berlin

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Thu Jan 31, 2013 3:53 pm

It looks like the Point version.
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm


Re: Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Fri Feb 01, 2013 9:41 am

bèzier curves -> This is one of the keywords that i was looking for. I will search for that and read it. :)

If somebody has additional good keywords.... Please let us know. Thank you.
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby Digoots » Fri Feb 01, 2013 7:14 pm

Digoots
 
Posts: 39
Joined: Mon May 02, 2011 7:16 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Sat Feb 02, 2013 12:23 pm

It looks like "Waypoint" tutorial.

Page 3 of the .pdf file looks like this: (For someone who needs that. It's flash)
http://www.emanueleferonato.com/2010/06/28/create-a-flash-racing-game-tutorial-artificial-intelligence/

There is a flash animation.
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Sat Feb 02, 2013 1:50 pm

It's unbelievable that I can't find nothing. I thought that this path thing is important for some game developers.

The best useful thing is still now the Link from "Pinkie Swirl". One of the best part of this tutorial is this here.
Image
This solution is good, because of the speed. The car has than the same speed at the curves.

I tried to do that with inkscape. But without success. I mean, I can draw curves. The problem is, that i can't make the curve nodes distances like in the picture.
Image

There also must be a program for that. I mean making the same distance.

And there must be a simple and perfect solution for that.
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby Pinkie Swirl » Sun Feb 03, 2013 11:51 am

In the link i gave you is stated, that you compute these points in your game. So load the curves, then compute the points, save those points and move your cars along this points.
Pinkie Swirl
 
Posts: 616
Joined: Thu Sep 20, 2012 8:55 pm

Re: Car (Sprite) follows (or moves on) the way (path)?

Postby gameZero » Sun Feb 03, 2013 12:41 pm

Yes, I think that's the only way.

I wanted to make it easier.
1. Draw the path with inkscape
2. Save the path
3. Car follows the path
gameZero
 
Posts: 56
Joined: Sun Jan 08, 2012 5:30 pm

Next

Return to Libgdx

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], native136, peterSweter, tuxToby and 19 guests