Forum Moderators: coopster

Message Too Old, No Replies

a bit different loop

         

xkid

12:38 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



Hi!

i want to set up a loop that for example adds 1 (like 4 + 1) to a colums in a row, and then adds 1 to the same column, at the next row, when the it comes to the last row, its starts over again..

THis is probably a louse explanation of my problem, but could anyone please help me to find the right direction? :)

Thanks!

Twisted Mind

12:48 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



What do you know of php or dont u know anything about it so we can help you in the right direction :)

Twisted Mind

12:50 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



U mean creating a counter?

xkid

12:56 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



i've been writing php for a while so i know a bit, but that loop-thing is freaking me out...

The purpose of the loop is to calculate battles in a game im making..

And to do so that the losses is divided between the defenders/attackers, i thought making a such loop would be an ok idea..

so if a ex. ship takes out 1.2 units of another ship it would be like this:

first loop:
def 1: 30-1.2
def 2: 26-1.2
def 3: 32-1.2

second loop:
def 1: 28.8-1.2
def 2: 24.8-1.2
def 3: 30.8-1.2

and so on...