Now i'm facing another problem. I wondering why my entities(sphere) unable goto the place i want. the location is show in the image...the sphere cant reach endpoint=3 and endpoint=4..
I attach my code below
CLS
SYNC ON : SYNC RATE 0 : AUTOCAM OFF
SET TEXT FONT "VERDANA" : SET TEXT SIZE 15
AI START
AI SET RADIUS 10
REM DIMENSION
ENTITIES=2
DIM STARTPOINT(ENTITIES)
DIM ENDPOINT(ENTITIES)
DIM ENTITIESON(ENTITIES)
WIDTH#=600 `X
HEIGHT#=100 `Y
DEPTH#=600 `Z
BUSBAYWIDTH#=200
BUSBAYDEPTH#=100
REM FLOOR
MAKE OBJECT BOX ENTITIES+1,WIDTH#,2,DEPTH#
POSITION OBJECT ENTITIES+1,0,-1,0
COLOR OBJECT ENTITIES+1,RGB(255,255,255)
REM BUS BAY 1
MAKE OBJECT BOX ENTITIES+2,BUSBAYWIDTH#,2,BUSBAYDEPTH#
POSITION OBJECT ENTITIES+2,WIDTH#/2+BUSBAYWIDTH#/2,-1,-DEPTH#/4
COLOR OBJECT ENTITIES+2,RGB(255,255,255)
REM BUS BAY 2
MAKE OBJECT BOX ENTITIES+3,BUSBAYWIDTH#,2,BUSBAYDEPTH#
POSITION OBJECT ENTITIES+3,WIDTH#/2+BUSBAYWIDTH#/2,-1,DEPTH#/4
COLOR OBJECT ENTITIES+3,RGB(255,255,255)
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,-(DEPTH#/2+65)
AI ADD OBSTACLE VERTEX WIDTH#/2,-(DEPTH#/4+BUSBAYDEPTH#/2)
AI ADD OBSTACLE VERTEX WIDTH#/2+BUSBAYWIDTH#,-(DEPTH#/4+BUSBAYDEPTH#/2)
AI ADD OBSTACLE VERTEX WIDTH#/2+BUSBAYWIDTH#,(DEPTH#/4+BUSBAYDEPTH#/2)
AI ADD OBSTACLE VERTEX WIDTH#/2,(DEPTH#/4+BUSBAYDEPTH#/2)
AI ADD OBSTACLE VERTEX WIDTH#/2,(DEPTH#/2+65)
AI ADD OBSTACLE VERTEX -WIDTH#/2,(DEPTH#/2+65)
AI END NEW OBSTACLE 0,1
REM FINISH CREATING OUR BOUNDARY
REM CREATE OBSTACLE TO SEPARATE THE TWO BUS BAY
AI START NEW OBSTACLE
AI ADD OBSTACLE VERTEX WIDTH#/2,DEPTH#/4-BUSBAYDEPTH#/2
AI ADD OBSTACLE VERTEX WIDTH#/2+1,DEPTH#/4-BUSBAYDEPTH#/2
AI ADD OBSTACLE VERTEX WIDTH#/2+1,1
AI ADD OBSTACLE VERTEX WIDTH#/2+BUSBAYWIDTH#,1
AI ADD OBSTACLE VERTEX WIDTH#/2+BUSBAYWIDTH#,-1
AI ADD OBSTACLE VERTEX WIDTH#/2+1,-1
AI ADD OBSTACLE VERTEX WIDTH#/2+1,-(DEPTH#/4-BUSBAYDEPTH#/2)
AI ADD OBSTACLE VERTEX WIDTH#/2,-(DEPTH#/4-BUSBAYDEPTH#/2)
AI END NEW OBSTACLE 0,1
REM FINISH OBSTACLE TO SEPARATE THE TWO BUS BAY
AI COMPLETE OBSTACLES
FOR I=1 TO ENTITIES
REM REBORN THE ENTITIES
CREATEENTITIES(I)
REM RESET STARTING POINT
STARTPOINTF(I,WIDTH#,HEIGHT#,DEPTH#,BUSBAYWIDTH#,BUSBAYDEPTH#)
NEXT I
DO
REM RESET THE ENTITIES ON THE STAGE
ENTITIESON=0
FOR I= 1 TO ENTITIES
IF AI GET ENTITY Z (I)<(DEPTH#/2) AND AI GET ENTITY Z (I)>(-DEPTH#/2)
SHOW OBJECT I
ENTITIESON(I)=1
ENDIF
REM ARRIVE DESTINATION AND DELETE OBEJCT
REM DESTINATION IS 1
IF ENDPOINT(I)=1 REM AND AI ENTITY EXIST(I)=1
IF AI GET ENTITY Z (I)<(-DEPTH#/2)
`AI KILL ENTITY I
`DELETE OBJECT I
ENTITIESON(I)=0
ENDIF
ENDIF
REM DESTINATION IS 2
IF ENDPOINT(I)=2 REM AND AI ENTITY EXIST(I)=1
IF AI GET ENTITY Z (I)>(DEPTH#/2)
`AI KILL ENTITY I
`DELETE OBJECT I
ENTITIESON(I)=0
ENDIF
ENDIF
REM CALCULATE THE NUMBER OF ENTITIES ON THE STAGE
ENTITIESON= ENTITIESON+ENTITIESON(I)
NEXT I
SET CURSOR 0,0`DEPTH#/4
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 "",WIDTH#/2+1
AI UPDATE
SYNC
LOOP
REM CREATE DIFF CATEGORIES OF ENTITIES
FUNCTION CREATEENTITIES(I)
CATEGORIES=0
REM NORMAL ADULT
IF CATEGORIES=0
MAKE OBJECT SPHERE I, 15
COLOR OBJECT I,RGB (255,0,0)
AI ADD ENEMY I
AI SET ENTITY SPEED I,25
ENDIF
SYNC
ENDFUNCTION
FUNCTION STARTPOINTF(I,WIDTH#,HEIGHT#,DEPTH#,BUSBAYWIDTH#,BUSBAYDEPTH#)
SYNC
STARTPOINT(I)= 1
IF STARTPOINT(I)=1
POSITION OBJECT I, RND(WIDTH#)-WIDTH#/2, 10,-(RND(40)+DEPTH#/2+25)
REM GO TO
ENDPOINT(I)=RND(1)+3
REM MAKE SURE NOT BACK TO SAME POSITION
WHILE ENDPOINT(I)=1
ENDPOINT(I)=RND(1)+3
ENDWHILE
ENDPOINTF(I,WIDTH#,HEIGHT#,DEPTH#,BUSBAYWIDTH#,BUSBAYDEPTH#)
ENDIF
SYNC
ENDFUNCTION
FUNCTION ENDPOINTF(I,WIDTH#,HEIGHT#,DEPTH#,BUSBAYWIDTH#,BUSBAYDEPTH#)
IF ENDPOINT(I)=3
AI ENTITY GO TO POSITION I,RND(BUSBAYWIDTH#*1/4)+WIDTH#/2+BUSBAYWIDTH#*3/4, -RND(DEPTH#/4-
BUSBAYDEPTH#/2)
ENDIF
IF ENDPOINT(I)=4
AI ENTITY GO TO POSITION I,(RND(BUSBAYWIDTH#*1/4)+WIDTH#/2+BUSBAYWIDTH#*3/4), RND(DEPTH#/4
-BUSBAYDEPTH#/2)
ENDIF
ENDFUNCTION
Again Thanks for all the kindly helps