Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: padman on October 04, 2014
-
Hi all,
Well, what can I say. I was bored, so I decided to code something. This is the outcome.
Required files + compiled executable available in the ZIP archive.
Enjoy! :cheers:
;******************************************************************************************
;* Pretty much a 1:1 conversion of Ayoros' CODEF remake at http://www.wab.com/?screen=245 *
;* with some minor modifications. *
;* SC68 tune originally ripped by Stormbringer *
;* Quickly hacked together & compiled with PureBasic 5.30 x86 by Padman in 2014. *
;* Exe size ~75Kb UPX'ed. Not too bad, eh? ^^ *
;******************************************************************************************
XIncludeFile "sc68_replay.pbi"
If InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Error", "Sprite system can't be initialized", 0)
End
EndIf
If OpenScreen(800, 600, 32, "Skid Row Remake")
CatchSprite(0,?s) : CatchSprite(1,?k) : CatchSprite(2,?i) : CatchSprite(3,?d) : CatchSprite (4,?r) : CatchSprite(5,?o) : CatchSprite(6,?w)
CatchSprite(7,?txt1) : CatchSprite (8,?txt2) :CatchSprite(10,?backgr)
For sprite = 0 To 6
TransparentSpriteColor(sprite,$FFFFFF) ; Set transparency to white
Next
TransparentSpriteColor(7,$FF00FF) : TransparentSpriteColor(8,$FF00FF) ; Set transparency to purple
CreateSprite(20,720,249) ; Create sprite for scanline effect
StartDrawing(SpriteOutput(20))
Box(0,0,720,240,$FFFFFF)
For i=0 To 240 Step 2
Line(0,i,720,1,$000000)
Next
StopDrawing()
TransparentSpriteColor(20,$FFFFFF) ; Set transparency to white
sc68replay_Init(?tune , ?tuneend-?tune, #SC68Replay_Memory) ; Init tune
sc68replay_Play() ; Start tune
Repeat
FlipBuffers()
ClearScreen(RGB(0,0,0))
DisplaySprite(10,40,180) ; Background
DisplayTransparentSprite(0,350 + 270 * Sin(angle.f), 190+15,fade) ;S
DisplayTransparentSprite(1,360 + 190 * Sin(angle.f), 197+15,fade) ;k
DisplayTransparentSprite(2,386 + 130 * Sin(angle.f), 209+15,fade) ;i
DisplayTransparentSprite(3,360 + 70 * Sin(angle.f), 197+15,fade) ;d
DisplayTransparentSprite(6,340 - 260 * Sin(angle.f), 254+15,fade) ;R
DisplayTransparentSprite(5,350 - 166 * Sin(angle.f), 255+15,fade) ;o
DisplayTransparentSprite(4,340 - 70 * Sin(angle.f), 198+15,fade) ;w
angle.f= angle.f+ 0.035
If vbl>=200 And vbl<700 : DisplayTransparentSprite(7,40,165+25) : EndIf ; Text page 1
If vbl>=700 And vbl<1100 : DisplayTransparentSprite(8,40,164+15) : EndIf ; Text page 2
If vbl>=1100 : vbl=0 : EndIf
vbl=vbl+1
If fade<255
fade=fade+5
Else
fade=255
EndIf
DisplayTransparentSprite(20,40,180)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
sc68replay_Stop() ; Stop tune
Else
MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf
DataSection
backgr:
IncludeBinary "res/backgr.bmp"
txt1:
IncludeBinary "res/txt1.bmp"
txt2:
IncludeBinary "res/txt2.bmp"
s:
IncludeBinary "res/s.bmp"
k:
IncludeBinary "res/k.bmp"
i:
IncludeBinary "res/i.bmp"
d:
IncludeBinary "res/d.bmp"
r:
IncludeBinary "res/r.bmp"
o:
IncludeBinary "res/o.bmp"
w:
IncludeBinary "res/w.bmp"
tune:
IncludeBinary "res/tune.sc68"
tuneend:
EndDataSection
[Edit] Typos and other cock-ups fixed. ::)
-
Very nice! :carrot:
-
Nice one padman and love the music :)
-
Thanks guys! :)
@inc: Thanks mate, but to keep my thread clean I moved your post here. (http://www.dbfinteractive.com/forum/index.php?topic=6270.0)
-
Hoi, very nice! Excellent work good sir! :cheers:
I was thinking how this came at exactly the right time, until I realised that any time is good demo time! That said, perfect timing! ;)
I also had a long lost memory popup about how I laboriously typed over a tunnel flying game in visual basic (I think it was) in hopes of learning programming. This was way before more succesfull efforts. Random memory popup... :)
-
any time is good demo time!
Word! Thanks mate! :)
-
Good job mate. It's nice to see something off you :updance:
-
very nice :) simple but effective.
-
Very cool! I remember watching the original, many years ago. Lovely as always, Padman :) K++
-
Thanks guys! :)
-
Nice :D
I would have code something, but... I'm too lazyyyyyy :crutches:
-
Nice and thanks for sharing.
When attempting to compile I am having a problem with sc68replay.lib . I believe it's built for something other than Mac Os X. Is my assumption correct? I've search but am unsure as to where I download and compile this lib.
thnkas.
-
You may compile the source in Windows. Also Check your purebasic Version.
Cheers
-
You may compile the source in Windows. Also Check your purebasic Version.
Cheers
thanks for the reply. I want to compile the lib under Mac os X . I'm using PureBasic 5.31 (MacOS X - x64). Where is the lib source ?
-
maybe "padman" is a gentleman and provide the lib (if he wrote the LIB? ) . you may ask him
-
maybe "padman" is a gentleman and provide the lib (if he wrote the LIB? ) . you may ask him
From what I can make out StormBringer wrote the Freebasic version http://www.dbfinteractive.com/forum/index.php?topic=3030.5
I'll pm PadMan and see how I progress.
Thanks.
-
A get following error message...
Line 54: DisplayTransparentSprite(): Incorrect numbers of parameters.
-
A get following error message...
Line 54: DisplayTransparentSprite(): Incorrect numbers of parameters.
I guess you are using a too old version of PB then. The sprite commands have been changed. I think this happened with version 5.20. Make sure to use a current version, i.e. 5.24 LTS or 5.31, to compile the source.
-
I guess you are using a too old version of PB then. The sprite commands have been changed. I think this happened with version 5.20. Make sure to use a current version, i.e. 5.24 LTS or 5.31, to compile the source.
Aha... im using a very old version (4.51). So I have to update asap :cheers:
-
Very nice remake.
I would suggest using a real timer than an incremental variable so that timing is maintained across all cpus :
start=(ElapsedMilliseconds()/30)
Repeat
vbl=(ElapsedMilliseconds()/30)-start
FlipBuffers()
ClearScreen(RGB(0,0,0))
DisplaySprite(10,40,180) ; Background
ssin.f = Sin(angle.f)
DisplayTransparentSprite(0,350 + 270 * ssin, 190+15,fade) ;S
DisplayTransparentSprite(1,360 + 190 * ssin, 197+15,fade);k
DisplayTransparentSprite(2,386 + 130 * ssin, 209+15,fade);i
DisplayTransparentSprite(3,360 + 70 * ssin, 197+15,fade);d
DisplayTransparentSprite(6,340 - 260 * ssin, 254+15,fade) ;R
DisplayTransparentSprite(5,350 - 166 * ssin, 255+15,fade) ;o
DisplayTransparentSprite(4,340 - 70 * ssin, 198+15,fade) ;w
angle.f= angle.f+ 0.035
If vbl>=35 And vbl<135 : DisplayTransparentSprite(7,40,165+25) : EndIf ; Text page 1
If vbl>=135 And vbl<265 : DisplayTransparentSprite(8,40,164+15) : EndIf ; Text page 2
If vbl>=295 : start=(ElapsedMilliseconds()/30) : EndIf
If fade<255
fade=fade+5
Else
fade=255
EndIf
DisplayTransparentSprite(20,40,180)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
-
Nice remake, thanks for sharing.
I add emook's mod with succes. :goodpost: