Wed, 18 Jun 1902 08:00:00 GMT
Help with the following routine
Hi, I have just started coding and soccer game, and I am still experimenting with the routines I am going to implement. The following routine should move the 11 players from one side of the ground to their designated kick off positions. It should be optimised so that it will skip players already in place while move the other players, but it seems that it cannot work. Can somebody come up with a better (and fast routine??): Procedure PlaceForDefault(WhatFor: Byte); Var PlayersOk: Boolean; PlyCnt,PlyOk: Byte; InPos: Array [1..11] of Byte; Begin For PlyCnt:=1 to 11 Do InPos[PlyCnt]:=0; PlayersOk:=False; Repeat For PlyCnt:=1 to 1 Do Begin If (Player[PlyCnt].CurrPos.X<>Tactic.CurrPos[WhatFor,PlyCnt].X) And (Player[PlyCnt].CurrPos.Y<>Tactic.CurrPos[WhatFor,PlyCnt].Y) Then Begin CalcPlayerPos(PlyCnt,Tactic.CurrPos[WhatFor,PlyCnt].X,Tactic.CurrPos[WhatFor,PlyCnt].Y); DrawPlayer(1,PlyCnt); End Else InPos[PlyCnt]:=1; End; PlyOk:=0; For PlyCnt:=1 to 1 Do PlyOk:=PlyOk+InPos[PlyCnt]; If PlyOk=1 Then PlayersOk:=True; Until PlayersOk; End; Please help me!! Tks & rgds, Ivan
