| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- Rem
- Another Oldskool demo thingy, by FlameDuck and Razorien of Binary Therapy
- End Rem
- Strict
- Type rasterBar
- Field angle:Double,angleadd:Double,color[],freq:Double
- Function addRasterBar(aSpeed:Double, aFreq:Double, aColor[], aList:TList)
- Local temp:rasterBar = New rasterBar
- temp.angle=0
- temp.angleadd=aSpeed
- temp.freq=aFreq
- temp.color = aColor
- aList.addLast(temp)
- End Function
- Method drawRasterBar(xstart:Int, ycenter:Int, scale:Double)
- SetBlend LIGHTBLEND
- SetColor(color[0],color[1],color[2])
- angle:+angleadd
- For Local i:Int = 0 To 736
- Local temp:Int = i+xstart
- If temp > 0 Or temp < 799
- DrawImage rastaImage, temp, ycenter + Sin((i+angle)*freq)*scale
- End If
- Next
- End Method
- End Type
- Type polarVector
- Field length:Double, angle:Double
- Function Create:polarVector(aLength:Double, anAngle:Double)
- Local temp:polarVector = New polarVector
- temp.length=aLength;temp.angle=anAngle
- Return temp
- End Function
- End Type
- Type baseEntity
- Field offset:polarVector, angvel:Double
- Method update(anx:Double, any:Double) Abstract
- End Type
- Type circleBob
- Field velocity:polarVector
- Field x:Double,y:Double
- Field life:Int
- Function CreateCircleBob:circleBob(anx:Double, any:Double, avelocity:polarVector)
- Local temp:circleBob = New circleBob
- temp.x=anx;temp.y=any;temp.velocity=avelocity
- temp.life=20
- Return temp
- End Function
- Method update()
- x:+Cos(velocity.angle)*velocity.length
- y:+Sin(velocity.angle)*velocity.length*yaspect
- life:-1
- SetAlpha life/40!
- DrawImage cmBob, x, y
- End Method
- Method isDead:Int()
- If life < 1
- Return True
- Else If x < 0 Or x > 799
- Return True
- Else If y < 0 Or y > 599
- Return True
- End If
- Return False
- End Method
- End Type
- Type spawn Extends baseEntity
- Field cBobs:TList
- Method update(anx:Double,any:Double)
- offset.angle:+ angvel
- anx:+Cos(offset.angle)*offset.length
- any:+Sin(offset.angle)*offset.length*yaspect
- Local temp:circleBob = circleBob.createCircleBob(anx,any, polarVector.Create(Rnd(4,8),ATan2((320-any),(368-anx))))
- cBobs.addlast(temp)
- For Local mycBob:circleBob = EachIn cBobs
- mycBob.update()
- If myCBob.isDead()
- cBobs.remove(mycBob)
- End If
- Next
- End Method
- Function Create:spawn(anAngle:Double, anAngvel:Double, aRadius:Double)
- Local temp:spawn = New spawn
- temp.cBobs = New TList
- temp.offset = polarVector.Create(aRadius, anAngle)
- temp.angvel=anAngvel
- Return temp
- End Function
- End Type
- Type anchor Extends baseEntity
- Field spawns:TList
- Method update(anx:Double, any:Double)
- offset.angle:-angvel
- For Local mySpawn:spawn = EachIn spawns
- mySpawn.update(anx+Cos(offset.angle)*offset.length, any+Sin(offset.angle)*offset.length*yaspect)
- Next
- End Method
- Function Create:anchor(anAngle:Double, anAngvel:Double, aRadius:Double, numSpawns:Int)
- Local ddeg:Double = 360:Double/numSpawns
- Local myAnchor:anchor = New anchor
- myAnchor.spawns=New TList
- myAnchor.offset = PolarVector.Create(aRadius, anAngle)
- myAnchor.angvel=anAngvel
- For Local i = 1 To numSpawns
- Local temp:spawn = spawn.Create(ddeg*i, anAngvel, aRadius/2)
- myAnchor.spawns.addlast temp
- Next
- Return myAnchor
- End Function
- End Type
- Type root
- Field anchors:TList
- Method update()
- For Local myAnchor:anchor = EachIn anchors
- myanchor.update(368,320)
- Next
- SetAlpha 1
- End Method
- Function Create:root(anAngvel:Double, aRadius:Double, numAnchors:Int, numSpawns:Int)
- Local ddeg:Double = 360:Double/numSpawns
- Local myRoot:root=New root
- myRoot.anchors = New TList
- For Local i = 1 To numAnchors
- Local temp:anchor = anchor.Create(ddeg*i, anAngvel, aRadius, numSpawns)
- myRoot.anchors.addlast temp
- Next
- Return myRoot
- End Function
- End Type
- Type imageStrip
- Field effectImages:TImage[16]
- Field counter:Int
- Function loadImages:imageStrip(name:String)
- Local temp:imageStrip = New imageStrip
- For Local i:Int = 0 To 15
- Local fname:String = name+String(i)+".png"
- temp.effectImages[i] = LoadImage(fname)
- Next
- temp.counter = 0
- Return temp
- End Function
- Method update(x:Int,y:Int)
- counter:-1
- If counter < 0
- counter=15
- EndIf
- DrawImage effectImages[counter],x,y
- End Method
- End Type
- Graphics 800,600,32
- Global yaspect:Double = 3/5!
- Global rastaImage:TImage = LoadImage("rasta.png")
- Global logo:TImage = LoadImage("cmanialogo.png")
- Global cmBob:TImage = LoadImage("circlebob.png")
- MidHandleImage logo
- Global maskEffect:imageStrip = imageStrip.LoadImages("anim")
- Local myRBList:TList = New TList
- rasterBar.addRasterBar(3!,2!, [255,0,0], myRBList)
- rasterBar.addRasterBar(5!,1.5!, [0,255,0], myRBList)
- rasterBar.addRasterBar(7!,1!, [0,0,255], myRBList)
- Local angle:Double = 0
- Local effectRoot:root = root.Create(4, 200, 6, 6)
- While Not KeyHit(KEY_ESCAPE)
- Cls
- Local xpos:Int = 124 * Sin(angle)
- For Local i:rasterBar = EachIn myRBList
- i.drawRasterBar(xpos+32 , 28!, 28!)
- Next
- SetBlend ALPHABLEND
- DrawImage logo, 400 + xpos,58
- angle:+4
- angle:Mod 360
- Local temp = 255*Abs((-180+angle)/180!)
- SetColor temp,temp,temp
- DrawLine 0,116,799,116
- SetColor 255,255,255
- effectRoot.update
- Flip
- End While
|