Hello,
I have a program that creates around 2000 bodies, but I don't want them to have the same name.
Now, they're all named "body", but I want them to get a name from "1" to "2000". I have a string with the number (it changes every time the create script is runned), but I can't create a body with the name in the string variable.
Does anyone know how?
Thank you
Variable name of body?
-
- Posts: 3
- Joined: Fri Jul 22, 2011 9:54 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Variable name of body?
You want to use an array.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Fri Jul 22, 2011 9:54 am
- Contact:
Re: Variable name of body?
Could you post a code example?
I don't get it why I have to use an array???
Thank you
I don't get it why I have to use an array???
Thank you
- AmIMeYet
- Posts: 6
- Joined: Mon Aug 15, 2011 8:32 am
- Contact:
Re: Variable name of body?
knutselman: Let me put it this way: why do you want to give your bodies a name? And how do you get/set the body names?
What slembcke means is that you can place your bodies in an array, and use that to reference specific bodies (i.e. instead of using names, you use the array index.)
What slembcke means is that you can place your bodies in an array, and use that to reference specific bodies (i.e. instead of using names, you use the array index.)
Who is online
Users browsing this forum: Heise IT-Markt [Crawler] and 7 guests