RTS movement + Collisions

For questions about using Classic.

Post » Sat Jan 30, 2010 11:44 am

Hello everyone!!!

I am developing a TDS game, and i faced a problem with collision detection. I will try to explain the problem.

I have a player, and some enemies. What i want - to make a sort of AI, so when enemy sees the player, he will start moving to player's position. The problem is that RTS movement behavior does not have collision checking, so the enemies' sprites overlap each other, as well as the player. Can you recommend me any solution to this problem?

Thanks a lot.
B
1
G
2
Posts: 3
Reputation: 631

Post » Sat Jan 30, 2010 12:02 pm

Turret behavior perhaps?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Jan 30, 2010 12:16 pm

You can use Custom Movement's collision checking... (maybe custom movement's "push out" controls hold the key you're looking for?)

Also, setting "object type to avoid" in RTS behaviour, with the object to avoid being the object its-self might give you a "good enough" result.
B
3
G
3
Posts: 46
Reputation: 967

Post » Sat Jan 30, 2010 12:35 pm

Thanks for the answers.

I tried "object type to avoid" but the result is not that good, push out also did not help.

Is there any way to use Physics and RTS together?

I seached the forum but did not find any good example of a TDS game. Could you help me to find one?
B
1
G
2
Posts: 3
Reputation: 631

Post » Sat Jan 30, 2010 12:43 pm

hmm. Just tried the custom movement "bounce" action. Actually gave a better result than push out, you should try that.

Edit: I don't think physics behaviour is really compatible with any other movement plugins...

Edit: Nevermind, bounce gives pretty poor results with lots of units.
B
3
G
3
Posts: 46
Reputation: 967

Post » Sat Jan 30, 2010 12:59 pm

Thanks, but now i have a different problem. Bounce works realy well with squares, but when i apply it to my sprites, it does not work. How can i solve it? Can i use some kind of custom collision mask as in Physics behavior?
B
1
G
2
Posts: 3
Reputation: 631

Post » Sat Jan 30, 2010 1:49 pm

A custom (square?) collision mask or bounding box might solve the problem. (Yes you can).
B
3
G
3
Posts: 46
Reputation: 967

Post » Sat Jan 30, 2010 5:34 pm

[quote="bessmertish":1pcurdqx]The problem is that RTS movement behavior does not have collision checking, so the enemies' sprites overlap each other, as well as the player[/quote:1pcurdqx]

You should check the "Solid" attribute on both player and enemy sprites. 8)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat Jan 30, 2010 9:30 pm

Actually "object type to avoid" is the best way to go, but it wont help any if you don't change the cell size to bigger than the sprite.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests