time = CreateTimer(60)
Global fov# = -10 ,GrX# = 330 , GrY# = 50,tx,ty
Const ttx = 40 , tty = 30 , KolvoBlock= 13
Dim MapX(KolvoBlock,KolvoBlock) , MapY(KolvoBlock,KolvoBlock) ,MapCenterX(KolvoBlock,KolvoBlock) , MapCenterY(KolvoBlock,KolvoBlock) ,map(KolvoBlock,KolvoBlock)
Graphics 800,600,32,2
SetBuffer BackBuffer()
;Origin 200,100
ClsColor 150,150,150
While Not KeyHit(1)
Cls
mx# = MouseX() : my# = MouseY()
fov = fov- MouseZSpeed() * 0.1
If MouseDown(1) Then
GrX = 800-mx
GrY = 250-my
FlushMouse()
EndIf
WaitTimer(time)
ty = Int(Floor( (my-GrY )/(tty+fov) ))
tx = Int(Floor( ((mx-GrX ) / (ttx+(ty+fov)))) +5 );
For y = 0 To KolvoBlock
For x = 0 To KolvoBlock
px# =( x-5)*(ttx+(y+fov)) ;-5
py# = y*(tty+fov)
pcx# =(( x-5)*(ttx+(y+fov))) +(ttx/2+(y/2+fov/2))
pcy# =y*(tty+fov)+(tty+fov)/2
MapX(x,y) = px
MapY(x,y) = py
If y<KolvoBlock And x<KolvoBlock Then
MapCenterX(x,y) = pcx
MapCenterY(x,y) = pcy
EndIf
Next
Next
Draw()
;Line mx-100,0,mx-100,500
If tx>=0 And tx < KolvoBlock And ty>=0 And ty<KolvoBlock Then
Text GrX *0.5-100,GrY +KolvoBlock*tty+10 ,tx+" : "+ty
EndIf
Flip
Wend
FreeTimer timer
End
Function DrawBackgraund()
End Function
Function Draw()
Rect 5,5,790, GrY +KolvoBlock*tty+25,0
For y = 0 To KolvoBlock
For x = 0 To KolvoBlock
Plot GrX +MapCenterX(x,y),GrY +MapCenterY(x,y)
Line GrX +MapX(x,0) , GrY , GrX +MapX(x,KolvoBlock) ,GrY +KolvoBlock*(tty+fov)
Line GrX +MapX(0,y) ,GrY +MapY(0,y) ,GrX +MapX(KolvoBlock,y) ,GrY +MapY(KolvoBlock,y)
Next
Next
End Function