Local d = 40
Const tilex = 4
Const tiley = 4
Graphics 640,480
;gex = LoadImage ("D:\vitalii\blitz\hex3.png") :MaskImage gex,255,255,255
gex = CreateImage(41,41)
SetBuffer ImageBuffer(gex)
Color 200,50,50
Line 0,20, 10,0
Line 10,0, 30,0
Line 30,0,40,20
Line 40,20 ,30,40
Line 30,40,10,40
Line 10,40,0,20
Color 255,255,255
SetBuffer BackBuffer()
s=h/Cos(30*Pi/180)/2
While Not KeyHit(1)
Cls
mx = MouseX() : my = MouseY()
For j=0 To tiley
For i=0 To tilex
x = i*d*1.5+(j Mod 2)*30
y = j*d*0.5
DrawImage gex, x , y
Text x+10,y+5,"i= "+i
Text x+10,y+15,"j= "+j
; Color 50,50,55
; Rect x,y,40,40,0
; Color 255,255,255
Next
Next
x2=mx/d/1.5 - (y2 Mod 2)/30 ;Проблема видимо тут
y2=my/d/0.5;
;y2=(my-(x2 Mod 2)*s)/h
;Oval x2-3,y2-3,6,6,1
Text 30 ,200 , "i - "+ x2+ " j - "+y2
Text 30 ,220 ,"(y2 Mod 2) = "+(my Mod 2)
Flip ; Меняем буфер
Wend
End