I've already got a nice simple system up and running, and I've actually got an original game idea to incorporate into it too :)
Here's a preview. Not sure if I'll be continuing with it though, as I just don't have a lot of time at the moment. :(
Simple, but effective - just move your mouse cursor around the level and press leftbutton to blow a hole in the landscape. BOOM!
[EDIT] Added to PB Code Tank - http://www.underwaredesign.com/pbct/pbct_dataview.php?key=40
I use the spritelocals function as it allows me to keep all the relevent sprite info together, depending on their type and without having to worry about Type arrays etc. I love Types in Blitz, but I really can't get on wth the amount of hassle that is required with PB Types.
The scrolling example maybe slows the sprites down due to its size and what is happening (its a huge image, which I realistically wouldn't use - 3200x420, but I just wanted to show that the screen can be large). Without any background or other bits, you can have over a thousand particles with little (if any slow-down on my pc). Don't forget that example is actually doing quite a lot in the background.
Besides - it works, so I'm sticking with it. :P
I'd be interested to see other versions though ;)
Animask is a redundant remnant from something else I was going to implement, but abandoned due to lack of time. It's a function for creating image animation frames and masking them all at the same time. I just forgot to take it out.
Thanks for the feedback though, it's greatly appreciated. :)
Hi again
QuoteBut I think 'Detonation' and 'Detonation2' are unbeatable!
But a 3rd place for me is better than no place. :)
This is 'Al Fredo, the snowsnail, has a mortar'.
snowsnail controls
move left left MB or left arrowkey
move right right MB or right arrowkey
aim with mousepointer
shoot middle MB or spacekey
F1 toggles 'snowgenerator'
[pbcode]
; PROJECT : Al Fredo, the snowsnail, has a mortar
; AUTHOR : stef
; CREATED : 05.11.2006
; EDITED : 09.11.2006
; ---------------------------------------------------------------------
;made with PB 1.55
;experimental code; not structured; not optimized
;snowsnail controls
;move left left MB or left arrowkey
;move right right MB or right arrowkey
;aim with mousepointer
;shoot middle MB or spacekey
;F1 toggles 'snowgenerator'
screenw=800
screenh=600
blockx=800
blocky=160
backimypos=0
backimxpos=0
bigpartsize=50
partsize=8
halfpartsize=partsize/2
numberofparts=300
explocounter=1
bulletnumber=1
flakemaker=1
maxflakes=1000
OpenScreen screenw,screenh,16,2
SetFPS 30
LoadFont "comic sans ms",2,60,1
blackpartim=NewImage(partsize,partsize)
RenderToImage blackpartim
Cls 0
Type tbullets
sprite
exist
p
x#,y#
dx#,dy#
EndType
Dim bullet(3) As tbullets
Type texplosionpos
exist
counter
x#,y#
EndType
Dim explosionpos(3) As texplosionpos
Type tcutpart
exist
im
ang#
rad#
x#,y#
dx#,dy#
EndType
Dim cutpart(numberofparts) As tcutpart
For x=0 To numberofparts
cutpart(x).im=NewImage(partsize,partsize)
Next
Dim flake(50)
Gosub stuffdrawing
Type tflakes
x#,y#
EndType
Dim flakes2(maxflakes) As tflakes
For x=0 To maxflakes
flakes2(x).x#=Rnd(screenw)
flakes2(x).y#=Rnd(screenh)
Next
Do
mx#=MouseX()
my#=MouseY()
If LeftMouseButton()=1 Or LeftKey()=1 Then movex=movex-3
If RightMouseButton()=1 Or RightKey()=1 Then movex=movex+3
aim=1
rotangle#=90+GetAngle2D(668+movex,540,mx#,my#)
If rotangle#>350 Then rotangle#=350:aim=0
If rotangle#<310 Then rotangle#=310:aim=0
If MidMouseButton()=1 Or SpaceKey()=1
FlushMouse
FlushKeys
if bullet(bulletnumber).exist=0
Gosub createbullet
endif
bulletnumber=bulletnumber+1
If bulletnumber=4 Then bulletnumber=1
EndIf
RenderToScreen
Cls RGB(0,0,150)
if functionkeys(1)=1
flushkeys
flakemaker=flakemaker*-1
endif
if flakemaker=1
gosub flakemaking
endif
DrawImage block,0,550,1
DrawImage backim,0,0,1
gosub bulletdraw
for b=1 to 3
if bullet(b).exist=1
if pointinbox(bullet(b).x#,bullet(b).y#,0,0,800,350)=1
rendertoimage backim
bullet(b).p= point (bullet(b).x#,bullet(b).y#)
if bullet(b).p>0
bullet(b).exist=0
gosub createexplosion
explosionpos(explocounter).exist=1
explocounter=explocounter+1
if explocounter=4 then explocounter=1
endif
endif
endif
rendertoscreen
next
RotateSprite gunsp,rotangle#
PositionSprite gunsp,668+movex,540
DrawSprite gunsp
DrawImage al_fredo,600+movex,460,1
ScrollImage wave,3,0
DrawImage wave ,628+movex,558,1
Gosub drawexplosion
DrawImage mouseim, mx#-10,my#-10,1
If aim=1 Then CircleC mx#,my#,counter,0,RGB(255,0,0)
If aim=0 Then CircleC mx#,my#,5,0,RGB(255,0,0)
counter=counter-1
If counter<0 Then counter=10
;Print FPS()
Sync
Loop
stuffdrawing:
block=NewImage(blockx,blocky)
block2=NewFXImage(blockx,blocky)
RenderToImage block
BoxC 0,10,800,150,1,RGB(200,200,250)
For x= 0 To 10000
r=RndRange(200,235)
CircleC Rnd(800),RndRange(10,150),RndRange(3,6),1,RGB(r,r,250);RGB(RndRange(128,255),RndRange(128,255),RndRange(128,255))
Next
For x= 0 To 10000
r=RndRange(200,235)
CircleC Rnd(800),RndRange(10,150),RndRange(2,3),1,RGB(r,r,250);RGB(RndRange(128,255),RndRange(128,255),RndRange(128,255))
Next
CopyImage block,block2
ball=NewFXImage(100,100)
RenderToImage ball
CircleC 50,50,40,1,RGB(200,200,250)
For x=0 To 10000
angle=Rnd(360)
radius=Rnd(40)
r=RndRange(200,235)
CircleC 50+CosRadius(angle,radius),50+SinRadius(angle,radius),RndRange(2,4),1,RGB(r,r,250)
Next
ss1=NewFXImage(100,100)
RenderToImage ss1
f#=0.05
For ang= 0 To 270 Step 10
DrawRotatedImage ball,CosRadius(ang,20+10*f)+70,SinRadius(ang,20+10*f)+10,ang,f#,f#,-50,-50,1
f#=f#+0.015
Next
MirrorImage ss1,1,0
al_fredo=NewImage(140,100)
RenderToImage al_fredo
DrawRotatedImage ss1 ,65,35,200,1,1,-50,-50,1
DrawRotatedImage ball,70,100,20,1.2,0.4,-50,-50,1
DrawRotatedImage ball,14,70,90,0.12,0.12,-50,-50,1
DrawRotatedImage ball,24,78,130,0.05,0.3,-50,-50,1
CircleC 12,68,3,1,RGB(50,50,50)
DrawRotatedImage ball,28,66,90,0.12,0.12,-50,-50,1
DrawRotatedImage ball,32,76,160,0.05,0.4,-50,-50,1
CircleC 26,63,3,1,RGB(50,50,50)
EllipseC 32,90,5,3,1,RGB(150,0,0)
wave=NewImage(74,20)
RenderToImage wave
For x= 0 To 74
LineC x,2+(Sin(x*10)),x,4+(Sin(x*10)),RGB(150,150,200)
Next
frosty=NewImage(100,200)
RenderToImage frosty
DrawRotatedImage ball,50,160,0,1,1,-50,-50,1
DrawRotatedImage ball,50,110,90,0.7,0.7,-50,-50,1
DrawRotatedImage ball,50,70,-90,0.5,0.5,-50,-50,1
DrawRotatedImage ball,20,100,30,0.5,0.3,-50,-50,1
DrawRotatedImage ball,80,100,-30,0.5,0.3,-50,-50,1
CircleC 50,70,5,1,RGB(220,20,20)
EllipseC 42,64,4,2,1,RGB(20,20,20)
CircleC 58,64,3,1,RGB(20,20,20)
For x= 0 To 60 Step 20
CircleC 50,100+x,3,1,RGB(20,20,20)
Next
For ang=60 To 150 Step 15
CircleC CosRadius(ang,10)+50,SinRadius(ang,10)+68,2,1,RGB(20,20,20)
Next
gun=NewFXImage(8,20)
RenderToImage gun
Cls RGB(100,0,0)
gunsp=GetFreeSprite()
CreateSprite gunsp
SpriteImage gunsp,gun
SpriteDrawMode gunsp,2
SpriteHandle gunsp, -4,-35
SpriteCollision gunsp,0
mouseim=NewImage(20,20)
RenderToImage mouseim
LineC 0,10,20,10,RGB(50,50,50)
LineC 10,0,10,20,RGB(50,50,50)
For x= 0 To 50
flake(x)=NewFXImage(5,5)
RenderToImage flake(x)
fac=Rnd(8)
If fac>0 Then fac=1
For ang#= 0 To 300 Step 60
LineC 2,2,CosNewValue(2,ang#,2),SinNewValue(2,ang#,2),fac*RGB(2*x+150,2*x+150,200);RGB(x*2,x*2,127);
Next
;BlurImage flake(x),4
Next
bullet=NewImage(8,8)
RenderToImage bullet
CircleC 4,4,4,1,RGB(255,255,0)
CircleC 4,4,3,1,RGB(200,0,0)
For x= 0 To 3
bullet(x).sprite=GetFreeSprite()
CreateSprite bullet(x).sprite
SpriteImage bullet(x).sprite,bullet
CenterSpriteHandle bullet(x).sprite
SpriteCollision bullet(x).sprite,1
SpriteCollisionClass bullet(x).sprite,%0001
SpriteCollisionMode bullet(x).sprite,6
Next
textim=NewImage(800,120)
RenderToImage textim
SetFont 2
Ink RGB(250,0,0)
CenterText 400,10,"'AL FREDO',THE SNOWSNAIL,"
CenterText 400,60,"HAS A MORTAR"
BlurImage textim,6
backim=NewImage(800,350)
RenderToImage backim
cls 0
DrawImage block,0,190,1
DrawImage frosty,50,50,1
DrawImage textim,0,200,1
Return
createexplosion:
explosionpos(explocounter).x#=bullet(b).x#
explosionpos(explocounter).y#=bullet(b).y#
RenderToImage backim
For x= 0 To (numberofparts/3)*explocounter
If cutpart(x).exist=0
cutpart(x).exist=1
cutpart(x).ang#=Rnd(360)
cutpart(x).rad#=Rnd(bigpartsize/2)
cutpart(x).dx#=Cos(cutpart(x).ang#)*cutpart(x).rad#/3.0
cutpart(x).dy#=Sin(cutpart(x).ang#)*cutpart(x).rad#/3.0
cutpart(x).x#=(CosNewValue(explosionpos(explocounter).x#,cutpart(x).ang#,cutpart(x).rad#));-halfpartsize
cutpart(x).y#=(SinNewValue(explosionpos(explocounter).y#,cutpart(x).ang#,cutpart(x).rad#));-halfpartsize
GetImage cutpart(x).im,cutpart(x).x#-halfpartsize,cutpart(x).y#-halfpartsize,cutpart(x).x#+halfpartsize,cutpart(x).y#+halfpartsize
DrawImage blackpartim,cutpart(x).x#-halfpartsize,cutpart(x).y#-halfpartsize,0
;circlec cutpart(x).x#,cutpart(x).y#,halfpartsize,1,rgb(0,0,0)
EndIf
Next
CircleC explosionpos(explocounter).x#,explosionpos(explocounter).y#,bigpartsize/2,1,RGB(0,0,0)
Return
drawexplosion:
For a=1 To 3
If explosionpos(a).exist=1
circlec explosionpos(a).x#,explosionpos(a).y#,bigpartsize/2,1,rgb(255,255,0)
explosionpos(a).exist=0
EndIf
Next
For x= 0 To numberofparts
If cutpart(x).exist=1
RenderToScreen
DrawImage cutpart(x).im,cutpart(x).x#+backimxpos,cutpart(x).y#+backimypos,1
cutpart(x).x#=cutpart(x).x#+cutpart(x).dx#
cutpart(x).y#=cutpart(x).y#+cutpart(x).dy#
cutpart(x).dy#=cutpart(x).dy#+0.2
If cutpart(x).x#<0 Or cutpart(x).x#>screenw Then cutpart(x).exist=0
If cutpart(x).y#<0 Or cutpart(x).y#>screenh Then cutpart(x).exist=0
If cutpart(x).exist=0
RenderToImage cutpart(x).im
Cls 0
EndIf
EndIf
Next
Return
createbullet:
bullet(bulletnumber).exist=1
bullet(bulletnumber).x#=668+movex
bullet(bulletnumber).y#=540
bullet(bulletnumber).dx#=cos(rotangle#-90)*12.0
bullet(bulletnumber).dy#=sin(rotangle#-90)*12.0
Return
bulletdraw:
for b=1 to 3
if bullet(b).exist=1
positionsprite bullet(b).sprite,bullet(b).x#,bullet(b).y#
bullet(b).x#=bullet(b).x#+bullet(b).dx#
bullet(b).y#=bullet(b).y#+bullet(b).dy#
bullet(b).dy#=bullet(b).dy#+0.15
if bullet(b).x#<0 or bullet(b).x#>screenw then bullet(b).exist=0
if bullet(b).y#<0 or bullet(b).y#>screenh then bullet(b).exist=0
drawsprite bullet(b).sprite
endif
next
return
flakemaking:
LockBuffer
For x = 0 To maxflakes
DrawImage flake(Rnd(50)),flakes2(x).x#,flakes2(x).y#,1
flakes2(x).y#=flakes2(x).y#+RndRange(0,5)
flakes2(x).x#=flakes2(x).x#+RndRange(0,5)
If flakes2(x).y#>screenh Then flakes2(x).y#=0
If flakes2(x).x#>screenw Then flakes2(x).x#=0
Next
UnLockBuffer
return
[/pbcode]
That's really cool. :)