summaryrefslogtreecommitdiff
path: root/gametypes.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'gametypes.bmx')
-rw-r--r--gametypes.bmx23
1 files changed, 21 insertions, 2 deletions
diff --git a/gametypes.bmx b/gametypes.bmx
index 7956568..1e5fb54 100644
--- a/gametypes.bmx
+++ b/gametypes.bmx
@@ -169,10 +169,12 @@ Type BackdropStar
Field r:Int
Field g:Int
Field b:Int
+ Field twinkle:Int
+ Field frame:Int
Method New()
x=Rand(0,800)
- y=Rand(0,600)
+ y=Rand(0,598)
r=Rand(128,255)
g=Rand(128,255)
b=Rand(128,255)
@@ -183,19 +185,36 @@ End Type
Type Backdrop
Const NUM:Int=100
Global s:BackdropStar[]
+ Global frame:Int
Function Init()
s=New BackdropStar[NUM]
For Local f:Int=0 Until NUM
s[f]=New BackdropStar
+ s[f].frame=f Mod 6
+ s[f].twinkle=Rand(100)>70
Next
+
+ frame=0
End Function
Function Draw()
+ frame=(frame+1) Mod 6
For Local f:Int=0 Until NUM
SetColor(s[f].r,s[f].g,s[f].b)
- DrawImage(GFX.star,s[f].x,s[f].y)
+ If s[f].twinkle
+ DrawImage(GFX.twinkle,s[f].x,s[f].y,s[f].frame)
+ If Not frame
+ s[f].frame=(s[f].frame+1) Mod 6
+ s[f].x=(s[f].x+2) Mod 800
+ EndIf
+ Else
+ DrawImage(GFX.star,s[f].x,s[f].y)
+ If Not frame
+ s[f].x=(s[f].x+1) Mod 800
+ EndIf
+ EndIf
Next
End Function
End Type