peter
17-05-2013, 18:50
Here some Aliens and Sound.
#INCLUDE "SDL.inc"
#INCLUDE "bass.inc"
SDL_Window 640,480,1
InitBass
Dim cx(60) As Long
Dim cy(60) As Long
Dim cd(60) As Long
Long c,star,sky,fx,xm
Single sv
For c=1 To 60
cx(c)=310
cy(c)=230
cd(c)=SDL_Rnd(1,8)
Next
star= SDL_LoadImage "img/bee.bmp",6
sky = SDL_LoadImage "img/bild12.png",1
xm = LoadMusic "img/music.mod"
PlayMusic (xm)
Sub Bees()
Long m
For m=1 To 60
SDL_Sprite star,cx(m),cy(m),fx
Next
End Sub
Sub bound()
Long x
For x=1 To 60
If cx(x) <=10 Then
cd(x) = SDL_Rnd(1,8)
cx(x) =10
End If
If cx(x) >=600 Then
cd(x) = SDL_Rnd(1,8)
cx(x) =600
End If
If cy(x) >=440 Then
cd(x) = SDL_Rnd(1,8)
cy(x) =440
End If
If cy(x) <=10 Then
cd(x) = SDL_Rnd(1,8)
cy(x) =10
End If
Next
End Sub
While SDL_Key(27)=0
SDL_Sprite sky,0,0,0
For c=1 To 60
If cd(c)=1 Then
cx(c)=cx(c)+1
bound
ElseIf cd(c)=2 Then
cx(c)=cx(c)-1
bound
ElseIf cd(c)=3 Then
cy(c)=cy(c)-1
bound
ElseIf cd(c)=4 Then
cy(c)=cy(c)+1
bound
ElseIf cd(c)=5 Then
cy(c)=cy(c)-1
cx(c)=cx(c)-1
bound
ElseIf cd(c)=6 Then
cy(c)=cy(c)-1
cx(c)=cx(c)+1
bound
ElseIf cd(c)=7 Then
cy(c)=cy(c)+1
cx(c)=cx(c)-1
bound
ElseIf cd(c)=8 Then
cy(c)=cy(c)+1
cx(c)=cx(c)+1
bound
End If
Next
Bees
sv +=.2
If sv >=1 Then
sv=0
fx +=1
If fx=6 Then fx=0
End If
SDL_Redraw
Wend
FreeBass
SDL_Quit
#INCLUDE "SDL.inc"
#INCLUDE "bass.inc"
SDL_Window 640,480,1
InitBass
Dim cx(60) As Long
Dim cy(60) As Long
Dim cd(60) As Long
Long c,star,sky,fx,xm
Single sv
For c=1 To 60
cx(c)=310
cy(c)=230
cd(c)=SDL_Rnd(1,8)
Next
star= SDL_LoadImage "img/bee.bmp",6
sky = SDL_LoadImage "img/bild12.png",1
xm = LoadMusic "img/music.mod"
PlayMusic (xm)
Sub Bees()
Long m
For m=1 To 60
SDL_Sprite star,cx(m),cy(m),fx
Next
End Sub
Sub bound()
Long x
For x=1 To 60
If cx(x) <=10 Then
cd(x) = SDL_Rnd(1,8)
cx(x) =10
End If
If cx(x) >=600 Then
cd(x) = SDL_Rnd(1,8)
cx(x) =600
End If
If cy(x) >=440 Then
cd(x) = SDL_Rnd(1,8)
cy(x) =440
End If
If cy(x) <=10 Then
cd(x) = SDL_Rnd(1,8)
cy(x) =10
End If
Next
End Sub
While SDL_Key(27)=0
SDL_Sprite sky,0,0,0
For c=1 To 60
If cd(c)=1 Then
cx(c)=cx(c)+1
bound
ElseIf cd(c)=2 Then
cx(c)=cx(c)-1
bound
ElseIf cd(c)=3 Then
cy(c)=cy(c)-1
bound
ElseIf cd(c)=4 Then
cy(c)=cy(c)+1
bound
ElseIf cd(c)=5 Then
cy(c)=cy(c)-1
cx(c)=cx(c)-1
bound
ElseIf cd(c)=6 Then
cy(c)=cy(c)-1
cx(c)=cx(c)+1
bound
ElseIf cd(c)=7 Then
cy(c)=cy(c)+1
cx(c)=cx(c)-1
bound
ElseIf cd(c)=8 Then
cy(c)=cy(c)+1
cx(c)=cx(c)+1
bound
End If
Next
Bees
sv +=.2
If sv >=1 Then
sv=0
fx +=1
If fx=6 Then fx=0
End If
SDL_Redraw
Wend
FreeBass
SDL_Quit