Page 1 of 1

Teams

PostPosted: Wed Apr 05, 2017 3:50 pm
by YouCanNotKnow
Im making a thing where 20 different teams go up against each other. There are 6 on each team and i want it if 1 team object bumps into another team object it kills. How do i make it so teams dont kill themselves or any block?

Re: Teams

PostPosted: Fri Apr 07, 2017 4:49 am
by Luezma
Please explain it detailed, I don't get it at all

Re: Teams

PostPosted: Fri Apr 07, 2017 4:25 pm
by YouCanNotKnow
So there are 20 teams (lets say each team has 5 different characters) in a box and they are battling. I want it so a team (lets say red team) can kill ANY other team (blue yellow green etc) but cant kill there own team. How do i do this?

Re: Teams

PostPosted: Sun Apr 09, 2017 11:35 pm
by Kilinich
You could add _team variable to the character's properties and check it in onCollide before remove.

Re: Teams

PostPosted: Thu Apr 20, 2017 3:58 pm
by FRA32
Here is a simple method to differentiate the teams:
In algodoo, every geometry has a "materialName" variable. I often use it as a universal identifier to check if something is of the correct type. So in order for your teams to work, name the materialName of every member the name of the corresponding team, for example "red, blue, yellow" etc. Then, all you need to do is go to onCollide to code events during collision, and check if the collision partner is NOT part of the own team, i.e. :
e.other.materialName != materialName && e.other.materialName != "" ? {e.other.timetolive = 0} : {}
By doing this, the collision of 2 objects with the same materialName, in other words the same team, will do nothing, just like the collision with something that's not part of a team. However, should 2 different team members collide, they will kill each other. You can modify the code in the first bracket to your liking, if instantaneous killing is not of your liking.