Page 1 of 1
hello again :)
Posted:
Tue Oct 18, 2011 9:22 am
by Agusstosus15
variatka[0]=variatka[0]+1;// counter of actors i moved earlier
obszar[1+variatka[0]]=actors[i].x; // remember position x of moved actor
obszar[2+variatka[0]]=actors[i].y; // remember position y of moved actor
strcpy (varatekst[variatka[0]],actors[i].name);// remember name of moved actor
is it correct?
Re: hello again :)
Posted:
Tue Oct 18, 2011 5:02 pm
by Agusstosus15
anybody?
Re: hello again :)
Posted:
Tue Oct 18, 2011 5:36 pm
by Hblade
seems correct.
Re: hello again :)
Posted:
Tue Oct 18, 2011 7:47 pm
by skydereign
So you have an array of Actor structs? I'd suggest using an array of Actor*s, but your obszar array will constantly be overriding the y being stored. I'd suggest making the array indexes match up.
Re: hello again :)
Posted:
Tue Oct 18, 2011 8:04 pm
by Agusstosus15
if (variatka[0]>0)
{
for (variatka[0]=variatka[0];variatka[0]<1;variatka[0]=variatka[0]-1)
{
ChangeParent(varatekst[variatka[0]], "las");
MoveTo(varatekst[variatka[0]], obszar[variatka[0]+2], obszar[variatka[0]+3], 100.000000, "Game Center", "");
ChangeZDepth(varatekst[variatka[0]], 0.501);
so why remembered actors doesn't back on remembered positions?
Re: hello again :)
Posted:
Tue Oct 18, 2011 8:12 pm
by skydereign
That for loop won't even run. You have an if that makes sure it is greater than 1. Then your condition in your for loop says that it must be less than 1. If variatka is an int array, then the for loop won't run at all.
Re: hello again :)
Posted:
Tue Oct 18, 2011 8:35 pm
by Agusstosus15
the middle condition in for loop is how long it goes
the start value of variatka is greater than one I'm sure
it goes that long as number of all my remembered actors will be less than 1
and so long for odds variatka the third action of for loop
where do i go wrong?
Re: hello again :)
Posted:
Tue Oct 18, 2011 8:45 pm
by skydereign
But, the condition of the for loop says that it will run until that condition is false. The condition must be false, because the if statement guarantees that it is greater than zero, while the condition of the for loop needs the value to be less than 1. Perhaps you meant variatka[0]>0 in the for loop?
Re: hello again :)
Posted:
Tue Oct 18, 2011 8:54 pm
by Agusstosus15
variatka on start is 1
so for is activated
variatka= variatka
until
variatka<1 witch is not
do
variatka=variatka-1
do instructions and go back
now variatka is 0 so it's end of for loop
isn't it ?
Re: hello again :)
Posted:
Tue Oct 18, 2011 9:07 pm
by skydereign
No, as soon as the condition of the for loop is not met, then the for loop ends. So since the condition of the for loop is not met on the first attempt (guaranteed by the if statement), the for loop ends and it moves on. The condition in the for loop is not, until something happens. It is do this until this is false. So as long as the condition is true, the loop will continue.
- Code: Select all
//typical for loop
int i;
for(i=0;i<10;i++)
{
//
}
The above for loop will run until i<10 is false.
Re: hello again :)
Posted:
Tue Oct 18, 2011 11:46 pm
by Agusstosus15
I used your suggestions but my actors flay away somewhere , but one is actin right
ok
see ya
thanks for everything
tomorrow
night