hello again :)

Game Editor comments and discussion.

hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 9:22 am

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?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 5:02 pm

anybody?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: hello again :)

Postby Hblade » Tue Oct 18, 2011 5:36 pm

seems correct.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: hello again :)

Postby skydereign » Tue Oct 18, 2011 7:47 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 8:04 pm

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?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: hello again :)

Postby skydereign » Tue Oct 18, 2011 8:12 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 8:35 pm

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?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: hello again :)

Postby skydereign » Tue Oct 18, 2011 8:45 pm

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?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 8:54 pm

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 ?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: hello again :)

Postby skydereign » Tue Oct 18, 2011 9:07 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: hello again :)

Postby Agusstosus15 » Tue Oct 18, 2011 11:46 pm

I used your suggestions but my actors flay away somewhere , but one is actin right

ok

see ya

thanks for everything :)

tomorrow
night
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest