Making sprite follow a predefined path

Discuss game development design and post your game ideas

Post » Mon Jul 06, 2015 7:14 am

Hi,

I working on a game which involves moving the player in a 8 shaped racing track automatically on start of the game.

Trace shape reference: http://www.gettyimages.in/detail/illust ... /514730893

One way I can think of based on the information from another threads and tutorials is creating placing sprite blocks and on overlap change the sprite direction and angle. But this involves creating lot of sprites and associating direction and angle for each sprite node which is a very tedious process.

Is there a easy way to do it like draw a line along the race track and sprite follows the path.

Thanks in advance
B
4
Posts: 3
Reputation: 206

Post » Mon Jul 06, 2015 10:03 am

Create nodes that your sprite follows
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Jul 06, 2015 10:59 am

I also wish there was an easy way to create weighted paths or splines that objects could follow. Maybe there is a plugin for that, not sure. The pathfinding can find the a route between points. Did you try it out?
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 945
Reputation: 12,212

Post » Mon Jul 06, 2015 1:35 pm

I've asked a few times for a spline based pathing implementation, and there is supoport from the user community but i dont think it's really something thats on Scirra's radar.
It's also requested for Construct 3. maybe some dev will be able to make a plugin. If i knew more on the coding side of things I would have attempted this myself.

Fusion has a very nice one.
The video shows only straight movement but bezier curve movement - back and forth, looping etc are all possible.

https://www.youtube.com/watch?v=wgh6mx_1zfM

Would be great to have something like this in Construct.

Currently as others have said you can make nodes that you can have the sprite move to, once it gets to the sprite let it look for the next sprite and so on.
B
26
S
7
G
4
Posts: 204
Reputation: 4,783

Post » Mon Jul 06, 2015 3:32 pm

you want something like this?
(quick example with 3 events/ need gmail account )
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Jul 06, 2015 4:06 pm

Thanks everyone!

@MadSpy: Yes I wanted something similar to this.

Are you using nodes and move to as others suggestion?

Can you please share the capx if possible for reference.

Thanks!
B
4
Posts: 3
Reputation: 206

Post » Mon Jul 06, 2015 4:17 pm

Just multiple instances of a sprite named "Path" that I place on the track. Bullet behavior for "car"
And a rotational movement to the angle of the next sprite.
6 minutes of work and 3 events
It is possible to improve it by putting two or three conditions and adding instance variable to the "car"

You can also use the pathfinding plugin but it increases CPU usage... depends of what you want and number of objects/solid...

Yes, I'll share the capx asap
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Mon Jul 06, 2015 5:09 pm

Thanks @MadSpy

I'm trying out what you suggested. I'm still a newbie and your capx would definitely help me to fast track.
B
4
Posts: 3
Reputation: 206

Post » Mon Jul 06, 2015 6:40 pm

As promise, here is the capx
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Tue Jul 07, 2015 8:32 am

Is there any way to make that curved movement instead of it going directly to the points?
B
26
S
7
G
4
Posts: 204
Reputation: 4,783

Next

Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 0 guests