objects overlapping while moving (capx inside)

Get help using Construct 2

Post » Sun Jul 28, 2013 6:40 pm

Example

I'm making a RTS type of game, and when units move around with path finding, they overlapped on each other.
So I gave them a physics behavior, which made them separate once they had arrived. Which was good, and even looks nice.

However, when they're moving to their destination, they still overlapped on the way.
So I made them Solid while moving and gave them the 8-move behavior so they knew it. Which actually works...

Now they don't overlap, and they behave neatly.
But it looks awful...

When two solid objects are colliding, they push each other away. So my objects are twitching all the way to their destination (and then solid is turned off, or they twitch there too)


Is there a way to achieve the same results but without all the twitching?Sargas2013-07-28 18:58:16
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Jul 28, 2013 9:16 pm

i feel this post is gonna disappear in the void =(
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Jul 28, 2013 10:14 pm

check rexrainbow's plugin "push out solid"
his thread: http://www.scirra.com/forum/app-my-plugins-repository-v2_topic52050.html
his wiki: https://dl.dropboxusercontent.com/u/5779181/C2Repo/index.html
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sun Jul 28, 2013 11:28 pm

what is happening now, is the objects are moving on a path to the destination, when they overlap the objects are trying to push eachother out (using physics or solid) but at the same time they want to keep following the path, result is bad movement, so you need an extra behavior - ai

it is called "avoidance" but its something you should program yourself, there are not many or no examples of such behavior in construct, you can look it up on the web - rts avoidance, avoidance steering

what probably should happen if a collision is going to happen (invisible trigger), one object should decide to hold/stop the pathfinder movement until there is no collision, if you want the objects to keep moving, while there going to be a collision, then you need to steer/direct the object to a place where there is no collison

it will take alot of coding i think, but it can be done, but its pretty advanced
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052


Return to How do I....?

Who is online

Users browsing this forum: Apollo14 and 27 guests