All pastes #596863 Raw Edit

atomimalli

public text v1 · immutable
#596863 ·published 2007-06-30 07:28 UTC
rendered paste body
SCREEN 200,150,32,2
Smooth2D ON
w=ScreenWidth()-1
h=ScreenHeight()-1
w2=w/2
h2=h/2
Dim texels(ScreenWidth(),ScreenHeight()) As Float
Dim texels2(ScreenWidth(),ScreenHeight()) As Float
img=LoadImage("media/level.bmp")
'img2=LoadImage("media/level.bmp")
'ResizeImage img2,w,h
For i=1 To 2'10' kuvan pehmennys, että näyttäisi nätimmältä.
ResizeImage img,w*2,h*2
ResizeImage img,w,h
Next i
Dim paletti(255)
    For i=0 To 255
        b=i^1.1'i*0.9+0.1*255
        If b<0 Then b=0
        If b>255 Then b=255
        Color i,i,Sin(i/2.833)*130'+(I/5.0)'b
        Dot 0,0
        paletti(i)=GetPixel(0,0,SCREEN())
    Next i
    For x=1 To ScreenWidth()
        For y=1 To ScreenHeight()
        'PickImageColor img2,x,y
        's2=((getRGB(RED)+getRGB(GREEN)+getRGB(BLUE))/3-128)*2+128
        PickImageColor img,x,y
        texels(x,y)=(Max(-150,Min(300,((getRGB(RED)+getRGB(GREEN)+getRGB(BLUE))/3-128)*2)))'*8+128+s2*3)/4 'Max(0.1,min(255,10255/Distance(x,y,140,100)^2))'Rand(0,255)
        Next y
    Next x
korkeus=45
Repeat
SetWindow Str(FPS())+"   "+(Timer()-aika)+"   "+korkeus+"   Nuolet ylös ja alas"
aika=Timer()
Lock SCREEN()
vl#=vl+3
vx=w2+Sin(vl)*(w2*0.85)
vy=h2+Sin(vl*1.3817)*(h2*0.85)
If UpKey() Then korkeus+3
If DownKey() Then korkeus-2
kulma=WrapAngle(kulma)
    For x=1 To w'279
    v+1:If v=2 Then v=0
        For y=1+v To h step 2'199'v To 199 Step 2

            kulma=GetAngle(vy,vx,y,x)
            kulma2=kulma-(kulma Mod 45)-45
            kulma3#=((kulma Mod 45)/45.0)
            
            eka=texels(x+Int(Cos(kulma2)),y+Int(Sin(kulma2)))*(kulma3)   
            toka=texels(x+Int(Cos(kulma2-45)),y+Int(Sin(kulma2-45)))*(1-kulma3)              
            d=(eka+toka)*0.85
            a=texels(x,y)-d+Sin(ATan(korkeus/Distance(vx,vy,x,y)))*250
            If a>255 Then a=255
            If a<0 Then a=0
            PutPixel2 x,y, paletti(a)
        Next y
    Next x
Unlock
DrawScreen OFF
Forever