Code archives/3D Graphics - Effects/Old School Demo

This code has been declared by its author to be Public Domain code.

Download source code

Old School Demo by CodeD2004
This is a graphical demo I put together in the spirit of the old C64/Amiga demos.
I used code from the following people (I made modifications to all of it here and there) Jeppe Nielson (sin scroller function), Semar (bullet function),
and JFK (screen sin distortion)
The babe used in this demo was done by FrogDot and used with permission. All other graphics are by me.
Wedoe has graciously hosted the binaries here:
http://www.blitzbasic.no/div/AmigaTributeCoded.zip
Global gfxBG, gfxflare
Global screenbk=CreateImage(GraphicsWidth(),GraphicsHeight())
Global underw_a
Graphics3D 640, 480,32, 1
SetBuffer BackBuffer() 
TFormFilter 1
Color 0,0,0
fntcms=LoadFont("Comic Sans MS", 16, False, False, False)
SetFont fntcms
n = 0
grlx = 1
grly = 1
grly2 = 641
grlxdir = 1
grly = 1
timex = 0
speedtimex = 6
run1 = 0
currentsong = 1: song$ = "Tower of Flames": artist$ = "Frederic Hahn"
Type t_bullet
Field x,y
Field speedx,speedy
End Type
Global bullet.t_bullet
gfxBG=LoadImage("coolblue.png")
gfxface = LoadImage("interface4.png")
gfxgirl=LoadImage("amigagirl.png")
gfxflare=LoadImage("ice.png")
chnBackground=PlayMusic("z-tower.xm")
While Not KeyHit(1) 
If KeyDown(203) Then timex = timex - 1
If KeyDown(205) Then timex = timex + 1
;if currentsong = 1 then song$ = "" and artist$  = "" ;etc, etc. simple song chooser
Cls
DrawImage gfxBG, 1, 1
WobbleView()
DrawImage gfxface, 1, facey
Text 100, 365, "NOW PLAYING"
Text 15, 395, "TITLE: "+song$ 
Text 15, 410, "ARTIST: "+artist$
Text 65, 435, "UP/DOWN TO CHANGE SONG"
Text 40, 450, "LEFT/RIGHT TO CHANGE TEXT SPEED"
x=timex/10.0 Mod 7000
bulletchance = Rnd(0,10): If bulletchance = 5 Then bullet.t_bullet = New t_bullet: bullet\x = Rnd(0,200): bullet\y = Rnd(0,10): bullet\speedx = Rnd(1,3): bullet\speedy = Rnd(1,3)
bulletchance2 = Rnd(0,100): If bulletchance = 10 Then bullet.t_bullet = New t_bullet: bullet\x = Rnd(0,200): bullet\y = Rnd(0,10): bullet\speedx = Rnd(1,3): bullet\speedy = Rnd(1,3)
updategame()
rendergame()
If grlxdir = 1 Then grlx = grlx + 1
If grlxdir = 2 Then grlx = grlx - 1
If grlx = 100 Then grlxdir = 2
If grlx = 1 Then grlxdir = 1
SinScroll (" ............... CodeD aka (DJ) Krazy K Presents Amiga Tribute Vol. 1 ... Press up/down to change songs ... Press left/right to change text speed/direction Code: CodeD, Jeppe Neilson (SinScroll), Semar (bullet code), JFK (distort) Gfx: FrogDot (thx for the babe!), CodeD ... Mods for Charity ... your donations help children!!! ... Visit http://sites.gwala.net/tormented/amiga for more info and to order the CD ... greetings to: Ckob, Lenn, Noel Cower, JFK, DJ SeeNSay, LizardKing, FutureCrew, Paradox, Mark Sibly & The Blitz Basic Crew, The Anonymous Modder ... Gotta have mod??  Amiga Tribute Vol. 2 coming soon!!  Cybernoid 3D coming soon!! Quality apps like this and more from CrapSoft and Evolved Dev Studios ............................ ", 100-x, 135, timex/10.0)
SinScroll (" ............... CodeD aka (DJ) Krazy K Presents Amiga Tribute Vol. 1 ... Press up/down to change songs ... Press left/right to change text speed/direction Code: CodeD, Jeppe Neilson (SinScroll), Semar (bullet code), JFK (distort) Gfx: FrogDot (thx for the babe!), CodeD ... Mods for Charity ... your donations help children!!! ... Visit http://sites.gwala.net/tormented/amiga for more info and to order the CD ... greetings to: Ckob, Lenn, Noel Cower, JFK, DJ SeeNSay, LizardKing, FutureCrew, Paradox, Mark Sibly & The Blitz Basic Crew, The Anonymous Modder ... Gotta have mod??  Amiga Tribute Vol. 2 coming soon!!  Cybernoid 3D coming soon!! Quality apps like this and more from CrapSoft and Evolved Dev Studios ............................ ", 100-x-1, 135, timex/10.0)
DrawImage gfxgirl, grlx, grly
DrawImage gfxgirl, grlx, grly2
Flip  
If timex < 0 Then timex = 0
timex = timex + speedtimex
;If KeyDown(200) Then currentsong = currentsong + 1: song$ = "Tower of Flames" And artist$ = "Frederic Hahn": FreeSound chnbackground: chnBackground=PlayMusic("z-tower.xm")
;If KeyDown(208) Then currentsong = currentsong - 1: song$ = "Tower of Flames" And artist$ = "Frederic Hahn": FreeSound chnBackground: chnBackground=PlayMusic("z-tower.xm")
If KeyDown(203) Then speedtimex = speedtimex - 1
If KeyDown(205) Then speedtimex = speedtimex + 1
Wend 
;===================================
Function updategame()
;===================================
For bullet.t_bullet = Each t_bullet
bullet\x = bullet\x + bullet\speedx
bullet\y = bullet\y + bullet\speedy
Next
End Function
;===================================
Function rendergame()
;===================================
For bullet.t_bullet = Each t_bullet
DrawImage gfxflare,bullet\x,bullet\y
Next
End Function
Function SinScroll(txt$,x,y,am,amp=50,per=20,d=10)
For n=1 To Len(txt$)
Text x+xx,y+Sin(am+n*per)*amp,Mid$(txt$,n,1)
xx=xx+d
Next
End Function
Function WobbleView()
 gw#=GraphicsWidth()
 gh#=GraphicsHeight()
 underw_a=(underw_a+4)
 steph#=gh/32
 mu8#=gh/60
 If underw_a>359 Then underw_a=0
  For iif#=0 To gh-4  Step .001
   wsin#=(Sin((underw_a+iif)Mod 360.0)*mu8#)
   CopyRect 0,  iif,         gw,steph+4, 0,iif+wsin#, ImageBuffer(screenbk),BackBuffer()
   iif=iif+steph
  Next
End Function

Comments

wedoe2004
How about a download on the binaries ?


wedoe2004
I got the binaries in the mail but can you send the compilation of it all because I get a "image does not exist" erreor message running the source......


CodeD2004
hmmm, yeah i'll send it again.


Clyde2004
Looks Awesome!
Please send the media dude :)


wedoe2004
Cool !
Looks sweet and oldskool to me :)


wedoe2004
/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\

Zipped binaries HERE

/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\
/\/\/\/\/\/\/\/\/\/\/\/\/\


Rob Farley2004
Not downloaded it, however...

Just scanning through you could replace

If grlxdir = 1 Then grlx = grlx + 1
If grlxdir = 2 Then grlx = grlx - 1
If grlx = 100 Then grlxdir = 2
If grlx = 1 Then grlxdir = 1
With
grlx = grlx + grlxdir
if grlx = 100 or grlx = 1 then grlxdir = - grlxdir


Also
bulletchance = Rnd(0,10): If bulletchance = 5 Then bullet...
With
If rand(0,10) = 5 then ....


Just a couple of little optimisations.


CodeD2004
Thanks for the tips Rob. I'm still a little stuck in the old ways of basic.


Gogs2005
just a note, since there is no 3d code it works in blitzplus with a few tweaks something like so:


Global gfxBG, gfxflare
Global screenbk=CreateImage(GraphicsWidth(),GraphicsHeight())
Global underw_a
Graphics 640, 480,32, 0
SetBuffer BackBuffer()
TFormFilter 1
Color 0,0,0
fntcms=LoadFont("Comic Sans MS", 16, False, False, False)
SetFont fntcms
n = 0
grlx = 1
grly = 1
grly2 = 641
grlxdir = 1
grly = 1
timex = 0
speedtimex = 6
run1 = 0
currentsong = 1: song$ = "Tower of Flames": artist$ = "Frederic Hahn"
Type t_bullet
Field x,y
Field speedx,speedy
End Type
Global bullet.t_bullet
gfxBG=LoadImage("coolblue.png")
gfxface = LoadImage("interface4.png")
;MaskImage(gfxface,255,0,255)
gfxgirl=LoadImage("amigagirl.png")
;MaskImage(gfxgirl,255,0,255)
gfxflare=LoadImage("ice.png")
;MaskImage(gfxflare,255,0,255)
chnBackground=PlayMusic("z-tower.xm")
While Not KeyHit(1)
If KeyDown(203) Then timex = timex - 1
If KeyDown(205) Then timex = timex + 1
;if currentsong = 1 then song$ = "" and artist$ = "" ;etc, etc. simple song chooser
Cls
DrawImage gfxBG, 1, 1
WobbleView()
DrawImage gfxface, 1, facey
Text 100, 365, "NOW PLAYING"
Text 15, 395, "TITLE: "+song$
Text 15, 410, "ARTIST: "+artist$
;Text 65, 435, "UP/DOWN TO CHANGE SONG"
Text 40, 450, "LEFT/RIGHT TO CHANGE TEXT SPEED"
x=timex/10.0 Mod 7000
bulletchance = Rnd(0,10): If bulletchance = 5 Then bullet.t_bullet = New t_bullet: bullet\x = Rnd(0,200): bullet\y = Rnd(0,10): bullet\speedx = Rnd(1,3): bullet\speedy = Rnd(1,3)
bulletchance2 = Rnd(0,100): If bulletchance = 10 Then bullet.t_bullet = New t_bullet: bullet\x = Rnd(0,200): bullet\y = Rnd(0,10): bullet\speedx = Rnd(1,3): bullet\speedy = Rnd(1,3)
updategame()
rendergame()
If grlxdir = 1 Then grlx = grlx + 1
If grlxdir = 2 Then grlx = grlx - 1
If grlx = 100 Then grlxdir = 2
If grlx = 1 Then grlxdir = 1
SinScroll (" ............... CodeD aka (DJ) Krazy K Presents Amiga Tribute Vol. 1 ... Press up/down to change songs ... Press left/right to change text speed/direction Code: CodeD, Jeppe Neilson (SinScroll), Semar (bullet code), JFK (distort) Gfx: FrogDot (thx for the babe!), CodeD ... Mods for Charity ... your donations help children!!! ... Visit http://sites.gwala.net/tormented/amiga for more info and to order the CD ... greetings to: Ckob, Lenn, Noel Cower, JFK, DJ SeeNSay, LizardKing, FutureCrew, Paradox, Mark Sibly & The Blitz Basic Crew, The Anonymous Modder ... Gotta have mod?? Amiga Tribute Vol. 2 coming soon!! Cybernoid 3D coming soon!! Quality apps like this and more from CrapSoft and Evolved Dev Studios ............................ ", 100-x, 135, timex/10.0)
SinScroll (" ............... CodeD aka (DJ) Krazy K Presents Amiga Tribute Vol. 1 ... Press up/down to change songs ... Press left/right to change text speed/direction Code: CodeD, Jeppe Neilson (SinScroll), Semar (bullet code), JFK (distort) Gfx: FrogDot (thx for the babe!), CodeD ... Mods for Charity ... your donations help children!!! ... Visit http://sites.gwala.net/tormented/amiga for more info and to order the CD ... greetings to: Ckob, Lenn, Noel Cower, JFK, DJ SeeNSay, LizardKing, FutureCrew, Paradox, Mark Sibly & The Blitz Basic Crew, The Anonymous Modder ... Gotta have mod?? Amiga Tribute Vol. 2 coming soon!! Cybernoid 3D coming soon!! Quality apps like this and more from CrapSoft and Evolved Dev Studios ............................ ", 100-x-1, 135, timex/10.0)
DrawImage gfxgirl, grlx, grly
DrawImage gfxgirl, grlx, grly2
Flip
If timex < 0 Then timex = 0
timex = timex + speedtimex
;If KeyDown(200) Then currentsong = currentsong + 1: song$ = "Tower of Flames" And artist$ = "Frederic Hahn": FreeSound chnbackground: chnBackground=PlayMusic("z-tower.xm")
;If KeyDown(208) Then currentsong = currentsong - 1: song$ = "Tower of Flames" And artist$ = "Frederic Hahn": FreeSound chnBackground: chnBackground=PlayMusic("z-tower.xm")
If KeyDown(203) Then speedtimex = speedtimex - 1
If KeyDown(205) Then speedtimex = speedtimex + 1
Wend
;===================================
Function updategame()
;===================================
For bullet.t_bullet = Each t_bullet
bullet\x = bullet\x + bullet\speedx
bullet\y = bullet\y + bullet\speedy
Next
End Function
;===================================
Function rendergame()
;===================================
For bullet.t_bullet = Each t_bullet
DrawImage gfxflare,bullet\x,bullet\y
Next
End Function
Function SinScroll(txt$,x,y,am,amp=50,per=20,d=10)
For n=1 To Len(txt$)
Text x+xx,y+Sin(am+n*per)*amp,Mid$(txt$,n,1)
xx=xx+d
Next
End Function
Function WobbleView()
gw#=GraphicsWidth()
gh#=GraphicsHeight()
underw_a=(underw_a+4)
steph#=gh/64
mu8#=gh/60
If underw_a>359 Then underw_a=0
For iif#=0 To gh-4 Step .001
wsin#=(Sin((underw_a+iif)Mod 360.0)*mu8#)
CopyRect 0, iif, gw,steph+4, 0,iif+wsin#
iif=iif+steph
Next
End Function


CodeD2006
Oh, WOW!!! Cool Gogs!! Thanks! People sifting through old code and making it new! Amazing! ;)

Seriously, though.

That's a good job. I'm sure your code is a lot cleaner than mine.

As I posted it as PD have fun with it. Just bear in mind, I did borrow code from some other guys with permission.

JFK thought it was cool I used his sin screen distortion ;)


Code Archives Forum