summaryrefslogtreecommitdiff
path: root/gametypes.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'gametypes.bmx')
-rw-r--r--gametypes.bmx191
1 files changed, 181 insertions, 10 deletions
diff --git a/gametypes.bmx b/gametypes.bmx
index 7c60b71..772b9e3 100644
--- a/gametypes.bmx
+++ b/gametypes.bmx
@@ -32,6 +32,8 @@ Type TWire
Const BOTTOM_RIGHT:Int=6
Const SPECIAL_BOMB:Int=7
Const SPECIAL_TWISTER:Int=8
+ Const SPECIAL_NUKE:Int=9
+ Const SPECIAL_CROSS:Int=10
Const DIR_NONE:Int=0
Const DIR_UP:Int=1
@@ -52,13 +54,32 @@ Type TWire
Field t:Int
Function Init()
- rotright=[0,2,1,4,6,3,5,7,8]
- rotleft=[0,2,1,5,3,6,4,7,8]
-
- img=[GameGFX.cross,GameGFX.left_right,GameGFX.top_bottom,GameGFX.top_left,GameGFX.top_right,GameGFX.bottom_left,GameGFX.bottom_right,GameGFX.special_bomb,GameGFX.special_twister]
-
- ' CROSS LEFT_RIGHT TOP_BOTTOM TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT SPECIAL_BOMB SPECIAL_TWISTER
- dir=[[DIR_UP,DIR_RIGHT,DIR_DOWN,DIR_LEFT], [DIR_NONE,DIR_RIGHT,DIR_NONE,DIR_LEFT], [DIR_UP,DIR_NONE,DIR_DOWN,DIR_NONE], [DIR_NONE,DIR_UP,DIR_LEFT,DIR_NONE], [DIR_NONE,DIR_NONE,DIR_RIGHT,DIR_UP], [DIR_LEFT,DIR_DOWN,DIR_NONE,DIR_NONE], [DIR_RIGHT,DIR_NONE,DIR_NONE,DIR_DOWN], [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE], [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE]]
+ rotright=[0,2,1,4,6,3,5,7,8,9,10]
+ rotleft=[0,2,1,5,3,6,4,7,8,9,10]
+
+ img=[GameGFX.cross, ..
+ GameGFX.left_right, ..
+ GameGFX.top_bottom, ..
+ GameGFX.top_left, ..
+ GameGFX.top_right, ..
+ GameGFX.bottom_left, ..
+ GameGFX.bottom_right, ..
+ GameGFX.special_bomb, ..
+ GameGFX.special_twister, ..
+ GameGFX.special_nuke, ..
+ GameGFX.special_cross]
+
+ dir=[[DIR_UP,DIR_RIGHT,DIR_DOWN,DIR_LEFT], .. ' CROSS
+ [DIR_NONE,DIR_RIGHT,DIR_NONE,DIR_LEFT], .. ' LEFT_RIGHT
+ [DIR_UP,DIR_NONE,DIR_DOWN,DIR_NONE], .. ' TOP_BOTTOM
+ [DIR_NONE,DIR_UP,DIR_LEFT,DIR_NONE], .. ' TOP_LEFT
+ [DIR_NONE,DIR_NONE,DIR_RIGHT,DIR_UP], .. ' TOP_RIGHT
+ [DIR_LEFT,DIR_DOWN,DIR_NONE,DIR_NONE], .. ' BOTTOM_LEFT
+ [DIR_RIGHT,DIR_NONE,DIR_NONE,DIR_DOWN], .. ' BOTTOM_RIGHT
+ [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE], .. ' SPECIAL_BOMB
+ [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE], .. ' SPECIAL_TWISTER
+ [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE], .. ' SPECIAL_NUKE
+ [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE]] ' SPECIAL_CROSS
dx=[0,0,1,0,-1]
dy=[0,-1,0,1,0]
@@ -121,16 +142,23 @@ Type TPiece Abstract
Field coli:Int
Field frame:Int
Field framed:Int
+ Field framespd:Int
+ Field framei:Int
+ Field pong:Int
Function Create:TPiece(special:Int)
Local o:TPiece
If special
- Select Rand(0,1)
+ Select Rand(0,3)
Case 0
o=TPiece(New TPiece_SpecialBomb)
Case 1
o=TPiece(New TPiece_SpecialTwister)
+ Case 2
+ o=TPiece(New TPiece_SpecialNuke)
+ Case 3
+ o=TPiece(New TPiece_SpecialCross)
End Select
Else
Select Rand(0,5)
@@ -154,10 +182,50 @@ Type TPiece Abstract
Return o
End Function
+ Function CreateSpecific:TPiece(t:Int)
+ Local o:TPiece
+ Local s:Int=False
+
+ Select t
+ Case 0
+ o=TPiece(New TPiece_S_Left)
+ Case 1
+ o=TPiece(New TPiece_S_Right)
+ Case 2
+ o=TPiece(New TPiece_L_Left)
+ Case 3
+ o=TPiece(New TPiece_L_Right)
+ Case 4
+ o=TPiece(New TPiece_Square)
+ Case 5
+ o=TPiece(New TPiece_Bar)
+ Case 6
+ o=TPiece(New TPiece_SpecialBomb)
+ s=True
+ Case 7
+ o=TPiece(New TPiece_SpecialTwister)
+ s=True
+ Case 8
+ o=TPiece(New TPiece_SpecialNuke)
+ s=True
+ Case 9
+ o=TPiece(New TPiece_SpecialCross)
+ s=True
+ Default
+ Return Create(False)
+ End Select
+
+ o.BaseInit(s)
+
+ Return o
+ End Function
+
Method Init() Abstract
Method BaseInit(special:Int)
special_pulse=False
+ framespd=5
+ pong=False
Init()
rot=0
ox=offx[rot]
@@ -167,6 +235,7 @@ Type TPiece Abstract
coli=-1
frame=0
framed=0
+ framei=1
End Method
Method Draw()
@@ -177,9 +246,16 @@ Type TPiece Abstract
EndIf
framed:+1
- If framed=5
+ If framed=framespd
framed=0
- frame=(frame+1) Mod 4
+ If pong
+ frame:+framei
+ If frame=0 Or frame=3
+ framei=-framei
+ EndIf
+ Else
+ frame=(frame+1) Mod 4
+ EndIf
EndIf
For Local px:Int=0 Until 4
@@ -481,6 +557,101 @@ Type TPiece_SpecialTwister Extends TSpecial
End Method
End Type
+Type TPiece_SpecialNuke Extends TSpecial
+ Method Init()
+ special_pulse=True
+ map[0,0]=TWire.Create([TWire.SPECIAL_NUKE])
+ offx=[0,0,0,0]
+ offy=[0,0,0,0]
+ End Method
+
+ Method AddToList(gm:TGameMap, l:TWireList, t:Int)
+ For Local px:Int=0 Until Pit.WIDTH
+ For Local py:Int=0 Until Pit.HEIGHT
+ If gm.map[px,py] And gm.map[px,py].t=t
+ l.Add(px,py,gm.map[px,py])
+ EndIf
+ Next
+ Next
+ End Method
+
+ Method DoSpecial:Int(gm:TGameMap)
+ Draw()
+
+ Local l:TWireList=New TWireList
+
+ If y<Pit.HEIGHT-1 And gm.map[x,y+1]
+ AddToList(gm,l,gm.map[x,y+1].t)
+ EndIf
+
+ If x>0 And gm.map[x-1,y]
+ AddToList(gm,l,gm.map[x-1,y].t)
+ EndIf
+
+ If x<Pit.WIDTH-1 And gm.map[x+1,y]
+ AddToList(gm,l,gm.map[x+1,y].t)
+ EndIf
+
+ If l.Count()=0
+ TextParticles.Big("WHAT A WASTE!",255,0,0)
+ Else
+ TextParticles.Big("SMART NUKE!",255,255,0)
+ gm.path.AddLast(l)
+ EndIf
+
+ ExplosionParticles.BlowUp(Pit.X(x),Pit.Y(y))
+
+ Return False
+ End Method
+End Type
+
+Type TPiece_SpecialCross Extends TSpecial
+
+ Method Init()
+ special_pulse=True
+ pong=True
+ map[0,0]=TWire.Create([TWire.SPECIAL_CROSS])
+ offx=[0,0,0,0]
+ offy=[0,0,0,0]
+ End Method
+
+ Method DoSpecial:Int(gm:TGameMap)
+ Draw()
+
+ TextParticles.Big("SUPER CROSS!",255,255,0)
+
+ For Local px:Int=x+1 Until Pit.WIDTH
+ If gm.map[px,y]
+ gm.map[px,y].t=TWire.CROSS
+ Particles.AddDust(Pit.X(px)+16,Pit.Y(y)+32)
+ EndIf
+ Next
+
+ For Local px:Int=0 Until x
+ If gm.map[px,y]
+ gm.map[px,y].t=TWire.CROSS
+ Particles.AddDust(Pit.X(px)+16,Pit.Y(y)+32)
+ EndIf
+ Next
+
+ For Local py:Int=y+1 Until Pit.HEIGHT
+ If gm.map[x,py]
+ gm.map[x,py].t=TWire.CROSS
+ Particles.AddDust(Pit.X(x)+16,Pit.Y(py)+32)
+ EndIf
+ Next
+
+ If Not gm.CheckWires()
+ gm.Flatten()
+ gm.CheckWires()
+ EndIf
+
+ ExplosionParticles.BlowUp(Pit.X(x),Pit.Y(y))
+
+ Return False
+ End Method
+End Type
+
Type TWireListEnt
Field w:TWire