Code:
;My Own Lemmings!!!!!
;-By F.Brandis
WBStartup:NoCli:CloseEd
BitMap1,320,256,4:BitMap0,320,256,4
dr$="blitzinc:_dat/"
LoadShapes0,dr$+"Lemms.shp"
dr$="blitzinc:_dat/iff/"
LoadBitMap0,dr$+"LemLev_b.iff",0
dr$="blitzinc:_dat/sfx/"
LoadSound0,dr$+"Lemm-Letsgo.sfx"
LoadSound1,dr$+"Lemm-Aehh!.sfx"
CopyBitMap0,1
VWait50
BLITZ
Slice0,44,4
Show0:Use Palette0
NEWTYPE.lemming
lemx.w
lemy.w
lemm.b ;frame
dir.b
fall.b
bcount.b ;new: bouncecount
End NEWTYPE
DEFTYPE.w
lan.b=40
Dim List l.lemming(lan)
USEPATH l()
While AddItem(l())
Gosub randomlem
Wend
Buffer0,(lan+1)*50*5
Buffer1,(lan+1)*50*5
Sound0,15
Repeat
Show db.b:db=1-db:Use BitMap db
VWait:UnBuffer db
;o.b+1:If o>100Then Sound1,15:o=0
ResetList l()
While NextItem(l())
If Point(\lemx,\lemy+5)<4
\lemy+2
If \fall=3
\lemm+1
If \lemm<18
\lemm=18
Else
If \lemm>21Then \lemm=18
EndIf
Else
\fall+1
EndIf
Else
\fall=0
Select \dir
Case1
\lemm+1:If \lemm>8Then \lemm=0
If Point(\lemx+2,\lemy)>3 ;boing! hit wall
If Point(\lemx+2,\lemy-1)=0
\lemy-2
If Point(\lemx+2,\lemy)>0
\lemy-2
EndIf
Else
\dir=2:\lemx-2
\bcount+1
EndIf
Else
\lemx+1
EndIf
Case2
\lemm-1
If \lemm<9
\lemm=17
Else
If \lemm>17 Then \lemm=17
EndIf
If Point(\lemx-2,\lemy)>3 ;boing! hit wall
If Point(\lemx-2,\lemy-1)=0
\lemy-2
If Point(\lemx+2,\lemy)>0
\lemy-2
EndIf
Else
\dir=1:\lemx+2
\bcount+1
EndIf ;boing-handle
Else
\lemx-1
EndIf
Default
Gosub randomlem
End Select
EndIf
BBlit db,\lemm,\lemx,\lemy
If \bcount>4 Then Gosub bc_handle
If \lemy>200OR \lemx>310OR \lemx<10Then Gosub randomlem; KillItem l()
Wend
Until Joyb(0)>0
End
bc_handle:
\bcount=0
Gosub randomlem
Return
randomlem:
\lemm=0
\lemx=Rnd(300)+10
\lemy=5
rd.b=1-rd
\dir=rd+1
Return
[attachment=16]