'Position_Enemies()' function...?

Blitz3D Forums/Blitz3D Beginners Area/'Position_Enemies()' function...?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Not enough information...like where is the X,Z position in relateion to the eneimes...how far they are to be spaced appart, etc...but here is a simple way of doing what you want:

function form_V(ammount%,xpos#,zpos#) 

;note: changed ammount to an integer

Svee%=1       ;counters for the loop
Evee%=ammount ;Start and End of the vee

Mpoint% = Evee / 2 ;trying to find the mid point

If (Evee AND 1) Then Mpoint = Mpoint + 1
;If the integer Evee is odd then add 1 to it to account for integer divide truncation (5/2=2 in integer math)


Xoff# = 10
Zoff# = -10

;the offsets or how far appart to place the enemies
;the values of xpos and zpos represnet the top-left corner of the vee

For i = Svee to Evee

  enemy = NEW enemytype

   PosistionEntity enemy, xpos, 0 ,zpos

 If i = Mpoint then Zoff = -(Zoff)

 xpos = xpos + Xoff
 zpos = zpos + Zoff

Next 

End function


the form_line function is even simpler:

Function form_line(ammount%,xpos#,zpos#)
;again ammount is an integer
;and xpos,zpos is in refrence to the left most side of the line

Xoff# = 10
;how far appart they should be

For i = 1 to ammount

  enemy = NEW enemytype
   
   PosistionEntity enemy, xpos,0,zpos

   xpos =xpos + Xoff

Next

End function


There is more to it, especialy involveing the use of entities/types...but I have a feeling that you just were trying to figure out how to get them into posistion more then anything