Hey
I have try to use a method so called move the entities from one point to another. Very first, I set the entities move to end of the barrier then move to the counter...
But it failed...
This is my code
REM DIMENSION
ENTITIES=2
DIM STARTPOINT(ENTITIES)
DIM ENDPOINT(ENTITIES)
DIM ENTITIESON(ENTITIES)
WIDTH#=600 `X
HEIGHT#=100 `Y
DEPTH#=600 `Z
REM CAMERA
REM *** W X H X D *** 500 X 100 X 500 ***
POSITION CAMERA 0,700,-(DEPTH#/2)
POINT CAMERA 0,0,0
REM FLOOR
MAKE OBJECT BOX ENTITIES+1,WIDTH#,2,DEPTH#
POSITION OBJECT ENTITIES+1,0,-2,0
COLOR OBJECT ENTITIES+1,RGB(255,255,255)
REM COUNTER
MAKE OBJECT BOX ENTITIES+8,20,50,20
POSITION OBJECT ENTITIES+8,-(WIDTH#/2-10),25,DEPTH#/2-12
COLOR OBJECT ENTITIES+8,RGB(100,150,200)
AI ADD STATIC OBSTACLE ENTITIES+8
REM LINE UP
MAKE OBJECT BOX ENTITIES+9,5,20,6.5*DEPTH#/8
POSITION OBJECT ENTITIES+9,-WIDTH#/2+38.5,10,0
COLOR OBJECT ENTITIES+9,RGB(100,150,200)
AI ADD STATIC OBSTACLE ENTITIES+9
REM MAKE BOUNDARY OBSTACLE, ENCLOSES THE SPACE TO KEEP THE ENTITY IN
REM ADD POINTS IN A ANTI-CLOCKWISE DIRECTION TO CREATE A BOUNDARY (USE CLOCKWISE TO CREATE AN OBSTACLE)
AI START NEW OBSTACLE
AI ADD OBSTACLE VERTEX -WIDTH#/2,-(DEPTH#/2+65)
AI ADD OBSTACLE VERTEX WIDTH#/2+65,-(DEPTH#/2+65)
AI ADD OBSTACLE VERTEX WIDTH#/2+65,(DEPTH#/2+65)
AI ADD OBSTACLE VERTEX -WIDTH#/2,(DEPTH#/2+65)
AI END NEW OBSTACLE 0,1
REM FINISH CREATING OUR BOUNDARY
AI COMPLETE OBSTACLES
`AI SET AVOID MODE 0
FOR I=1 TO ENTITIES
REM REBORN THE ENTITIES
CREATEENTITIES(I)
REM RESET STARTING POINT
STARTPOINTF(I,WIDTH#,HEIGHT#,DEPTH#)
NEXT I
DO
SET CURSOR 0,0
PRINT "NO. OF ENTITIES: ",ENTITIESON," / ",ENTITIES
PRINT ""
PRINT "CATEGORIES:- "
PRINT " ADULT - RED"
PRINT " ELDERLY - GREEN"
PRINT " DISABLE - BLUE"
PRINT "STARTPOINT(1): ",STARTPOINT(1)
PRINT "ENDPOINT(1): ", ENDPOINT(1)
PRINT "STARTPOINT(2): ",STARTPOINT(2)
PRINT "ENDPOINT(2): ", ENDPOINT(2)
PRINT "",AI GET ENTITY X (1)," ",AI GET ENTITY Z (1)
PRINT "",-WIDTH#/2+36," ",-6*DEPTH#/16
AI UPDATE
SYNC
LOOP
REM CREATE DIFF CATEGORIES OF ENTITIES
FUNCTION CREATEENTITIES(I)
CATEGORIES=RND(4)
REM NORMAL ADULT
IF CATEGORIES=0 OR CATEGORIES=3 OR CATEGORIES=4
`ENTITIESSIZE=15
MAKE OBJECT SPHERE I, 12
COLOR OBJECT I,RGB (255,0,0)
AI ADD ENEMY I
AI SET ENTITY SPEED I,35
ENDIF
REM ELDERLY
IF CATEGORIES=1
MAKE OBJECT SPHERE I, 15
COLOR OBJECT I,RGB(0,255,0)
AI ADD ENEMY I
AI SET ENTITY SPEED I,35`10
ENDIF
REM DISABLE PEOPLE
IF CATEGORIES=2
MAKE OBJECT SPHERE I, 18
COLOR OBJECT I,RGB(0,0,255)
AI ADD ENEMY I
AI SET ENTITY SPEED I,35`5
ENDIF
`HIDE OBJECT I
`AI Set Entity Avoid Distance I, 10
`AI SET ENTITY AGGRESSIVE I
SYNC
ENDFUNCTION
REM STARTING POINT
FUNCTION STARTPOINTF(I,WIDTH#,HEIGHT#,DEPTH#)
STARTPOINT(I)=1`RND(3)+1
REM AT EXIT 1
IF STARTPOINT(I)=1
POSITION OBJECT I, RND(WIDTH#-100)-WIDTH#/2, 10,-(RND(40)+DEPTH#/2+25)
REM GO TO
ENDPOINT(I)=0
ENDPOINTF(I,WIDTH#,HEIGHT#,DEPTH#)
ENDIF
SYNC
ENDFUNCTION
FUNCTION ENDPOINTF(I,WIDTH#,HEIGHT#,DEPTH#)
IF ENDPOINT(I)=0
COUNTERF(I,WIDTH#,HEIGHT#,DEPTH#)
ENDIF
ENDFUNCTION
FUNCTION COUNTERF(I,WIDTH#,HEIGHT#,DEPTH#)
AI ENTITY GO TO POSITION I,-WIDTH#/2+19,-6.5*DEPTH#/16
IF AI GET ENTITY X (I) < -WIDTH#/2+40 AND AI GET ENTITY Z (I) < -6*DEPTH#/16
AI ENTITY GO TO POSITION I,-(WIDTH#/2-19),(DEPTH#/2-32)
AI ENTITY STAND I
ENDIF
ENDFUNCTION
Thanks for your kindly helps...