Показать сообщение отдельно
Старый 08.10.2013, 21:28   #8
polopok
ПроЭктировщик
 
Регистрация: 17.07.2009
Сообщений: 182
Написано 51 полезных сообщений
(для 71 пользователей)
Ответ: некоторые изометрические демки

Ага , я сам тащюсь .

всё тоже самое но по другому
Чур на чёрный кружочек не смотреть , он стесняется .
maxX = 100 : maxY= 100

Dim c#(maxX ,maxY)
Graphics 800,600,32,2 
SetBuffer BackBuffer() 

s=10
;c(90,10)= 20

ClsColor 152,251,152
While Not KeyHit(1) 
Cls 
mx = MouseX() : my=MouseY() : z= Abs(MouseZ () )+1

mmy= (2*my-mx)/2
mmx= mx+mmy


If KeyHit(2) Then q= Not q
If KeyHit(57) Then flips=Not flips

If MouseDown(1) Then md=1 Else md=0

Color 60,179,113
Rect s,s,maxX ,maxY,1


	For y= 1 To maxY ;Step 2
		For x=1 To maxX   ;Step 2
			If x+s<=maxX+s  And x+s>=0 And y+s<=maxY+s And y+s>=0 Then

				If Int( (((mx+s )-( x+s))^2 + ((my+s) -( y+s))^2)^.5 )= z ;And md=1  	
					Color 222,222,222
					Plot x+s,y+s
					If md=1	
					If q=0 Then c(x,y)= c(x,y)+Rnd(3)
					If q=1 Then c(x,y)= c(x,y)-Rnd(3)
					
					If c(x,y)> 255 Then c(x,y)=255
					
					If c(x,y)<=0 Then c(x,y)=0

					EndIf 		
				EndIf 

			EndIf 
		Next 
	Next 


;If md=0
	For y= 1 To maxY ;Step 2
		For x=1 To maxX  ;Step 2

			If flips=0 Then frontX= 200+(x-y) : frontY= 300+((x+y)/2) Else frontX=(200+maxX)+ (-x-y) : frontY= (300+maxY /2)+((-x+y)/2)		 
			
			co = 50+c(x,y)
			If co>255 Then co =255
			If co<=0 Then 
			 co=0
			Color 0,0,255
			Plot 200+frontX,200+frontY-c(x,y)
			Else 
			Color co,co,co

			Line   frontX,frontY-c(x,y)  , frontX,frontY-c(x,y) +5
			
			EndIf
			If Int( ((mx - x)^2 + (my - y)^2)^.5 )<= z 
			If x+1<=maxX  And x-1>=0 And y+1<=maxY And y-1>=0 And md=1
			If c(x,y) > c(x-1,y-1) Then c(x-1,y-1)=c(x,y)- 2
			If c(x,y) > c(x-1,y+1) Then c(x-1,y+1)=c(x,y)- 2
			If c(x,y) > c(x+1,y-1) Then c(x+1,y-1)=c(x,y)-2
			If c(x,y) > c(x+1,y+1) Then c(x+1,y+1)=c(x,y)-2
			
			If c(x,y) > c(x,y-1) Then c(x,y-1)=c(x,y)- 1
			If c(x,y) > c(x,y+1) Then c(x,y+1)=c(x,y)- 1
			If c(x,y) > c(x-1,y) Then c(x-1,y)=c(x,y)- 1
			If c(x,y) > c(x+1,y) Then c(x+1,y)=c(x,y)-1
			EndIf 
			EndIf 
		Next 
	Next 
Color 22,22,22
Oval 200+mmx-3,300+mmy-3,6,6,1
Text 300,20,"Q "+q+" flips = "+ flips

Flip 
Wend 
End  

Function DistABS(ax,ay,bx,by)
	Return  (Abs(bx-ax)+Abs (by-ay))
End Function
__________________
Мой проект здесь
(Offline)
 
Ответить с цитированием