Differentiate geometries?
9 posts • Page 1 of 1
Differentiate geometries?
Hello there,
Sorry for asking, but how do you make a script to differentiate a box, circle, and polygon? I've been trying to do this based on the geometries' properties, such as size, radius, but since it throws up undefined my ideas are constantly being thrown out the window. I'm sure there is a painfully simple way to do this, but I couldn't find anything in a search.
Thanks!
Sorry for asking, but how do you make a script to differentiate a box, circle, and polygon? I've been trying to do this based on the geometries' properties, such as size, radius, but since it throws up undefined my ideas are constantly being thrown out the window. I'm sure there is a painfully simple way to do this, but I couldn't find anything in a search.
Thanks!
.
-
icrls984 - Posts: 80
- Joined: Thu Jun 13, 2013 6:33 am
Re: Differentiate geometries?
{""+object} gives you object name: "polygon", "circle", "box" etc.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Differentiate geometries?
kilinich - I tried {""+object} and it shows "undefined".
BTW - Who is that person in your new profile picture?
BTW - Who is that person in your new profile picture?
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Differentiate geometries?
Xray wrote:kilinich - I tried {""+object} and it shows "undefined".
BTW - Who is that person in your new profile picture?
I think he meant e.other or e.this as object
-
carl00s01 - Posts: 24
- Joined: Fri Nov 26, 2010 7:03 pm
- Location: Brazil
Re: Differentiate geometries?
Xray wrote:kilinich - I tried {""+object} and it shows "undefined".
BTW - Who is that person in your new profile picture?
object means it's some variable like e.this, e.other or result of scene.entityByGeomID()
BTW - It's me )
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Differentiate geometries?
You look a little bit like I did 20 years ago. I also have a beard.
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Differentiate geometries?
Kilinich wrote:object means it's some variable like e.this, e.other or result of scene.entityByGeomID()
BTW - It's me )
So, the correct usage would be something along the lines of "e.this.object" or "e.other.object" or something similar?
I ask because I've been trying to find a way to do this for some time.
Also nice whiskers.
(/)(°,,,°)(/)
-
pnvv - Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: Differentiate geometries?
pnvv wrote:Kilinich wrote:object means it's some variable like e.this, e.other or result of scene.entityByGeomID()
BTW - It's me )
So, the correct usage would be something along the lines of "e.this.object" or "e.other.object" or something similar?
I ask because I've been trying to find a way to do this for some time.
Examples:
for box:
onCollide = (e) => {text = "" + e.other}
for laser:
onLaserHit = (e) => {"" + e.geom == "circle" ? {e.geom.color = color}:{}}
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests