store data in "n" scene.my. variables
			3 posts			 • Page 1 of 1		
	
store data in "n" scene.my. variables
hey there .
i have a question about creating scene.my. variables in a row .
i want for n times the laser hits something , that the newest position is saved as an array in a scene.my.
but creating scene.my.var(i) or something like this that could allow a ongoing row is not possible.
how would i do that ?
it should look like that after:
i have a circle that moves
sim.time=0 => e.pos=[0,0]
now i hit the activation key of a laser and the pos will be saved in scene.my.var0
sim.tim=13 => e.pos=[35.6,0]
when i hit the key now , it should not reset scene.my.var0, it should create a new scene.my.var1 with the new position
as is said, i could not get it working with the
what could i do?
			i have a question about creating scene.my. variables in a row .
i want for n times the laser hits something , that the newest position is saved as an array in a scene.my.
but creating scene.my.var(i) or something like this that could allow a ongoing row is not possible.
how would i do that ?
it should look like that after:
i have a circle that moves
sim.time=0 => e.pos=[0,0]
now i hit the activation key of a laser and the pos will be saved in scene.my.var0
sim.tim=13 => e.pos=[35.6,0]
when i hit the key now , it should not reset scene.my.var0, it should create a new scene.my.var1 with the new position
as is said, i could not get it working with the
- Code: Select all
 for(n ,(i)=>{})
what could i do?
yup yup 
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
		yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
 - Posts: 85
 - Joined: Mon Dec 20, 2010 12:02 pm
 - Location: Germany
 
Re: store data in "n" scene.my. variables
there are few ways to do that.
must suitable (IMHO) is to add values to list and increment counter
//init
scene.my.array := [];
scene.my.count := 0;
//add value
scene.my.array = scene.my.array ++ [e.pos];
scene.my.count = scene.my.count + 1;
//read and display array
for (scene.my.count, (i) => {print("Pos #" + i + " = " + scene.my.array(i)});
			must suitable (IMHO) is to add values to list and increment counter
//init
scene.my.array := [];
scene.my.count := 0;
//add value
scene.my.array = scene.my.array ++ [e.pos];
scene.my.count = scene.my.count + 1;
//read and display array
for (scene.my.count, (i) => {print("Pos #" + i + " = " + scene.my.array(i)});
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: store data in "n" scene.my. variables
ah alright did not think of lists
thank you !
			thank you !
yup yup 
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
		yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
- hiltropper
 - Posts: 85
 - Joined: Mon Dec 20, 2010 12:02 pm
 - Location: Germany
 
			3 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 3 guests



