In reply to: Thanks.. -- William 13:14:57 12-03-2004
Here Posted by: Xorlak 04:07:00 12-07-2004 |
It looks like you already have the basic framework down. The 'slot!' variable corresponds to the enemy number, right? All you have to do is pass that variable with all your methods. (Actually you don't really have to since all variables are global, but it'll look nicer):
#Method xplusone(slot!)
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!+33
}
#Method xminusone(slot!)
{
#enexx[slot!]!=enex[slot!]!
#enexx[slot!]!=enexx[slot!]!-33
}
#Method yplusone(slot!)
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!+33
}
#Method yminusone(slot!)
{
#eneyy[slot!]!=eney[slot!]!
#eneyy[slot!]!=eneyy[slot!]!-33
}
#Method EnemyTurn(slot!)
{
#Random(4,Random!)
#If(Random!=1){#Branch(:top)}
#check(slot!)
#Method check(slot!)
{
#xplusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack(slot!)}}
#xminusone()
#If(enexx[slot!]!=x!){#If(eney[slot!]!=y!){#EnemyAttack(slot!)}}
#yplusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack(slot!)}}
#yminusone()
#If(eneyy[slot!]!=y!){#If(enex[slot!]!=x!){#EnemyAttack(slot!)}}
#Branch(:Move)
}
#Method EnemyEqualStoneLocation(slot!)
{
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex1!){#If(eney[slot!]!=stoney1!){#enex[slot!]!=enex[slot!]!-33}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!+33}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#eney[slot!]!=eney[slot!]!-33}}}
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!+33}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=stonex2!){#If(eney[slot!]!=stoney2!){#enex[slot!]!=enex[slot!]!-33}}}
}
#Method EnemyEqualCharacterLocation(slot!)
{
#If(enedir[slot!]$="LEFT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!+33#If(enex[slot!]!<175)
{#enex[slot!]!=210}}}}
#If(enedir[slot!]$="RIGHT"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#enex[slot!]!=enex[slot!]!-33#If(enex[slot!]!>610)
{#enex[slot!]!=606}}}}
#If(enedir[slot!]$="UP"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!+33#If(eney[slot!]!<60)
{#eney[slot!]!=67}}}}
#If(enedir[slot!]$="DOWN"){#If(enex[slot!]!=x!){#If(eney[slot!]!=y!){#eney[slot!]!=eney[slot!]!-33#If(eney[slot!]!>300)
{#eney[slot!]!=298}}}}
#SetImageTransparent(enetst[slot!]$,enex[slot!]!,eney[slot!]!,32,32,255,255,255)
#Branch(:top)
}
:Move
#If(eney[slot!]!>y!)
{
#eney[slot!]!=eney[slot!]!-33
#enedir[slot!]$="UP"
#EnemyEqualStoneLocation(slot!)
#EnemyEqualCharacterLocation(slot!)
}
#If(enex[slot!]!>x!)
{
#enex[slot!]!=enex[slot!]!-33
#enedir[slot!]$="LEFT"
#EnemyEqualStoneLocation(slot!)
#EnemyEqualCharacterLocation(slot!)
}
#If(eney[slot!]!<y!)
{
#eney[slot!]!=eney[slot!]!+33
#enedir[slot!]$="DOWN"
#EnemyEqualStoneLocation(slot!)
#EnemyEqualCharacterLocation(slot!)
}
#If(enex[slot!]!<x!)
{
#enex[slot!]!=enex[slot!]!+33
#enedir[slot!]$="RIGHT"
#EnemyEqualStoneLocation(slot!)
#EnemyEqualCharacterLocation(slot!)
}
}*Method EnemyTurn End*
#Method EnemyAttack(slot!)
{
*#GetStats()
#enefp!=eneFP[slot!]!
#eneFP!=eneFP!-dp!
#If(enefp!<2){#eneFP!=2}
#HP!=HP!-enefp!
#CheckCharDead()
}*Method EnemyAttack End*
Now in the main part of your battle system, you'll just call #EnemyTurn with the number of whatever enemy's turn it is. I'd imagine you'd have something like this:
#for(i!=0;i!<3;i!=i!+1)
{
#enemyturn(i!)
}
Also, it looks like you're #branch-ing to places outside of your methods. This might look like it works at first, but it can cause some serious problems if your battles draw out for a while. (Cesque can tell you what happens, heh...) You might want to restructure you code to avoid that. (i.e. remember that a method will return to where it was called when it is finished; branching at the end of a method is unnecessary).