PDA

View Full Version : Ufos Observation



peter
01-12-2013, 17:54
Hi,


Uses "ui","math"
#INCLUDE "abc.inc"


DWord hdc, hwnd
hwnd = Canvas_Window("ThinBasic",xMiddle(386),yMiddle(240),386,240)
Canvas_Attach(hwnd,0,%TRUE)
hdc = Canvas_GetDC()
SetHandleDC hdc, hwnd
SetColorKey Rgb(255,128,255)


Dim j,uz,ux,uy,b1,b2,b3,b4 As Long
Single us
uy=40


b1 = LoadBmp "bmp/baum1.bmp",1
b2 = LoadBmp "bmp/gate.bmp" ,1
b3 = LoadBmp "bmp/moon.bmp",1
b4 = LoadBmp "bmp/new_ufo.bmp",3


Dim xstars(200) As Long
Dim ystars(200) As Long
Dim sstars(200) As Long
Dim colors(200) As Long


For j=1 To 200
xstars(j) = Rand(1,386)
ystars(j) = Rand(1,120)
sstars(j) = Rand(1,4)
colors(j) = Rand(64,255)
Next


While IsWindow(hwnd) And Keydown(27)=0
Canvas_Clear Rgb 0,255,0


DrawRect 0,0,388,140,0,0
DrawBmp b2,0,102,128,38,0
DrawBmp b2,128,102,128,38,0
DrawBmp b2,256,102,128,38,0

DrawBmp b1, 00,100,96,128,0
DrawBmp b1, 96,100,96,128,0
DrawBmp b1,192,100,96,128,0
DrawBmp b1,288,100,96,128,0
DrawBmp b3,10,10,32,32,0
DrawBmp b4,ux+Sin(DegToRad(us))*60,uy+Cos(DegToRad(us))*10,24,20,uz
DrawBmp b4,ux+(-Sin(DegToRad(us))*60),uy+Cos(DegToRad(us))*20,24,20,uz
DrawBmp b4,ux+(-Sin(DegToRad(us))*30),uy+(-Cos(DegToRad(us))*10),24,20,uz

For j=1 To 200
DrawPoint xstars(j),ystars(j),2,2, Rgb(colors(j),colors(j),colors(j))
Next

ux +=1
If ux >=412 Then ux= -24

uz +=1
If uz=3 Then uz=0

us +=1
If us >=360 Then us = -us

Canvas_Redraw
SetFps 60
Wend
FreeGraphic
Canvas_Window End