Teams

About advanced scenes, and the Thyme scripting language used in Algodoo.

Teams

Postby YouCanNotKnow » Wed Apr 05, 2017 3:50 pm

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?
YouCanNotKnow
 
Posts: 3
Joined: Wed Apr 05, 2017 3:45 pm

Re: Teams

Postby Luezma » Fri Apr 07, 2017 4:49 am

Please explain it detailed, I don't get it at all
Luezma
 
Posts: 14
Joined: Thu Dec 13, 2012 7:19 pm
Location: Argentina

Re: Teams

Postby YouCanNotKnow » Fri Apr 07, 2017 4:25 pm

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?
YouCanNotKnow
 
Posts: 3
Joined: Wed Apr 05, 2017 3:45 pm

Re: Teams

Postby Kilinich » Sun Apr 09, 2017 11:35 pm

You could add _team variable to the character's properties and check it in onCollide before remove.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Teams

Postby FRA32 » Thu Apr 20, 2017 3:58 pm

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.
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron