PDA

View Full Version : Father Cristmas



peter
30-11-2013, 20:03
Hi,

with ufo.


Uses "ui"
#INCLUDE "abc.inc"

DWord hdc, hwnd
hwnd = Canvas_Window("ThinBasic",xMiddle(800),yMiddle(600),800,600)
Canvas_Attach(hwnd,0,%TRUE)
hdc = Canvas_GetDC()
SetHandleDC hdc, hwnd
SetFont 18,28,%FW_BOLD,"courier"

Type Star
xStar As Long
yStar As Long
speed As Long
rStar As Long
End Type

Dim stars(500) As Star
Dim xRes,yRes,a,uz,stern,ufo,i,a,jupi As Long
Dim v,uv As Single

xRes =800
yRes =600

stern = LoadBmp "bmp/stern.bmp",6
jupi = LoadBmp "bmp/jupiter.bmp",1
ufo = LoadBmp "bmp/ufostrip.bmp",8

Sub InitStars()
For i=1 To 500
Stars(i).xStar = Rand(1, xRes -2)
Stars(i).yStar = Rand(1, yRes -2)
Stars(i).speed = Rand(1, 4)
Stars(i).rStar = Rand(8, 32)
Next
End Sub

Sub MoveStars()
For i=1 To 500
DrawBmp stern,Stars(i).xStar,Stars(i).yStar,Stars(i).rStar,Stars(i).rStar,a
Stars(i).xStar = Stars(i).xStar + Stars(i).speed
If Stars(i).xStar > xRes Then
Stars(i).xStar = -32
Stars(i).yStar = Rand(1, yRes -2)
Stars(i).speed = Rand(1, 4)
Stars(i).rStar = Rand(8, 32)
End If
Next
End Sub

InitStars
While IsWindow(hwnd) And KeyDown(27)=0
Canvas_Clear 0
Sprite jupi,10,10,0
Sprite ufo,336,236,uz
MoveStars
Canvas_Redraw
SetFps (80)

uv +=.25
If uv >=1 Then
uv=0
uz +=1
If uz=8 Then uz=0
End If

v +=.2
If v >=1 Then
v=0
a +=1
If a=6 Then a=0
End If
Wend
FreeGraphic
Canvas_Window End

mike lobanovsky
30-11-2013, 20:40
Looks better regarding not GPF'ing outrageously at exit as it used to. That's a plus.

In other respects, as user-unfriendly as ever. That's a minus.

jack
30-11-2013, 20:41
hello peter, where is the abc.inc ?

peter
30-11-2013, 20:52
Hi Jack,

here!

jack
30-11-2013, 22:30
thank you :)