Challenge #1 - Destructible Terrain

Started by kevin, November 02, 2006, 10:15:48 AM

Previous topic - Next topic

kevin





Challenge #1 - Destructible Terrain



Outline

       We challenge you to make a 'Worms' styled destructible terrain example in PlayBasic.  The player should be able to blast through the terrain in some way.    You can decide how.    The challenge is to demonstrate how you can  achieve the destructible terrain effect, rather then create a playable Worms remake.


Never seen worms ?

  Here's a few links to various version of the worms.

  Worms Directors Cut (Amiga)
  Various Intro/Game Screen Shots




Submission

     * Submissions can be written in any version of PlayBasic

     * Submission can only be accepted in Source Code form only.

     * Authors can use external Media (images/music) provided  you created the media, have obtained permission to use somebody else's media  or the media is public domain.

     * Zip up your Submissions and please try to keep it smaller than 500K !

     * Authors automatically give consent for their submission(s) to distributed and used for promotional purposes via UnderwareDesign.com, PlayBasic code tank. 

     * Authors can submit as many times as they like.

     * To make a submission,  zip up your projects source code + media and either post it in this thread, or create your own a thread the Source Codes or Show Case forums and post a link bellow.



Ian Price

I came. I saw. I played some Nintendo.

kevin


Since there's no judgment, it's open-ended. 

Ian Price

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 :)

I came. I saw. I played some Nintendo.

Ian Price

#4
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 came. I saw. I played some Nintendo.

kevin


Ian Price

#6
Uploaded a new version to the CodeTank that includes scrolling :)

Use the mouse to scroll - pressing RIGHT mousebutton scrolls twice as fast.

CodeTank link  (old link removed)

  Get Ian's Worms Source Code Here For PlayBASIC


I came. I saw. I played some Nintendo.

stef

Hi Ian

Not bad! :)

It seems you like this tech with using 'spritelocals'. You  used this tech (spritelocals) already in your 'snow-example'. I prefer more simple programming techs.
In my opinion it's very elegant method, but a little bit slow if you use many particles.

BTW The function 'animask(....)' seems to be redundant in the codes ( but I assume it's for future development :))

Greetings
stef


Ian Price

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. :)
I came. I saw. I played some Nintendo.

stef

QuoteI'd be interested to see other versions though

Hm?! The same as I :)
But I think 'Detonation' and 'Detonation2' are unbeatable! :)
Someone could only reach the 3rd place in this challenge. :)

BTW Thinking about taking part in that 'Christmas-compo', but I still haven't a really good idea.

Ian Price

QuoteBut I think 'Detonation' and 'Detonation2' are unbeatable! :)

Cheers, but I'm sure there are numerous other ways to do the same thing.

Re: Xmas compo. I've got an original game idea, that I have had for several years that I've never got round to putting pixel to screen. Maybe this year will be the same :P
I came. I saw. I played some Nintendo.

stef

#11
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'


PlayBASIC Code: [Select]
; 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

Login required to view complete source code



Ian Price

I came. I saw. I played some Nintendo.

stef

Hi!

Thx for reply!
QuoteThat's really cool.
Hm?! I think you mean that it contains a lot of snow and ice :)

That winter-relationship is caused by the searching for a chritmas-compo-idea. (but shouldn't have that destructive effect :))

kevin

#14
  Scramble

  Here's my attempt..  


 Note: it was written using PB1.56

Get Scramble From The PlayBASIC Source Code


  Edit: updated old link