Code: Select all
sub render(tiles() as tile,agents() as agent,cam As camera)
Line cam.vscreen,(0,0)-(cam.w,cam.h),rgb(100,0,0),bf
dim as integer i,jy2,vv1,vv2,v1=cam.vy-th, _
v2=cam.vy+cam.h,v3=cam.vx-tw, _
v4=cam.vx+cam.w,v5=cam.vx-tw3, _
v6=cam.vx+cam.w+tw3
for i=0 to numtiles
if tiles(i).phy>v1 andalso tiles(i).phy<v2 andalso _
tiles(i).phx>v3 andalso tiles(i).phx<v4 then
If tiles(i).picref>-1 Then tiles(i).drawr(tiles(i).picref,0,cam,1)
If tiles(i).picref2>-1 Then tiles(i).drawr(tiles(i).picref2,0,cam,1)
end if
next
for jy as integer=cam.vy-120 to cam.vy+cam.w step (twhh)
jy2=jy-(jy mod twhh):vv1=jy2+thh:vv2=jy2+th
for i=0 to numtiles
if tiles(i).picref3>-1 andalso (tiles(i).phy-tiles(i).offy)=jy2 andalso _
tiles(i).phx>v5 andalso tiles(i).phx<v6 then _
tiles(i).drawr(tiles(i).picref3,0,cam,0)
next
for i=0 to numagents
if agents(i).phy+thh>=vv1 andalso agents(i).phy<vv2 andalso _
agents(i).phx>v3 andalso agents(i).phx<v4 then _
agents(i).drawr(agents(i).direc+(agents(i).imgref*8),1,cam)
next
next
end sub