Dark Bit Factory & Gravity

PROGRAMMING => Purebasic => Topic started by: padman on January 20, 2012

Title: Arcane Cracktro Remake + Purebasic Source Code
Post by: padman on January 20, 2012
Hi guys!

Compiled with PB 4.41. Feel free to do whatever ever you want with it...

Pad  ;)

Code: [Select]
;##########################################################################################
;# Time for another little cracktro remake con source code by Padman. (c)01/2012          #
;# I've included some very basic comments which are meant for beginners, so they can      #
;# easily spot where what is going on...                                                  #
;# Libminifmod170 by rbz is used for music replay.                                        #                                       
;# And it uses Shockwave's / va!n's scroller code which can be found at:                  #
;# http://www.dbfinteractive.com/forum/index.php?topic=1436.0                             #
;# The starfield might also be from some tutorial, can't really remember ;)               #
;########################################################################################## 


Global  xres.w , yres.w , loop.w ,xp.w , yp.w , t.s , tptr.w , sco.b


IncludeFile "scroll.pbi"                             
IncludeFile "libminifmod170.pbi"


xres  = 640           
yres  = 480           
sco   = 0
tptr  = 1
FPS = 60
TimerDuration = 1000 / FPS



;#### Setup Starfield

#STARS = 100
#MAX_SPEED = 8.1


Structure Stars
x.f
y.f
Speed.f
Shade.l
EndStructure
Dim Stars.Stars(#STARS)



For i = 0 To #STARS
Stars(i)\X = Random(640)
Stars(i)\Y = 105+Random(288)
Stars(i)\Speed = Random(#MAX_SPEED)
Stars(i)\Shade = 255 / #MAX_SPEED * Stars(i)\Speed
Next



;#### Init stuff, Sprite3D is used for zooming

InitSprite()                     
InitSprite3D()
InitKeyboard()                 
   


;#### Open up the DX9 screen 640x480
               
 window = OpenScreen( xres , yres , 32 , "Arcane Cracktro Remake")     

If window = 0                                           
  MessageRequester("Error", "This is fucked up, I can't open the window", 0)       
  End                                                   
EndIf



;#### Catch the font pic


CatchSprite(1,?font,#PB_Sprite_Texture)
TransparentSpriteColor(1,$000008)


;#### Create a sprite for our stars and paint a 2x2 box on it

CreateSprite(50, 2, 2, #PB_Sprite_Texture)
StartDrawing(SpriteOutput(50))
Box(0, 0, 2, 2, #White)
StopDrawing()
CreateSprite3D(50, 50)


;#### Catch the logo sprite and zoom it

CatchSprite(0,?logo,#PB_Sprite_Texture)
CreateSprite3D(0,0)
ZoomSprite3D(0,SpriteWidth(0)*2,SpriteHeight(0)*2)

;#### Init and start the music replay

  MiniFmod_Init(?mod,?endmod-?mod)
  MiniFmod_Play()

Repeat
 
 
 
  timer = ElapsedMilliseconds()   
 
  ClearScreen($0)                                       
                                   

;#### This displays the starfield
    Start3D()

For i = 0 To #STARS
Stars(i)\X + Stars(i)\Speed
If Stars(i)\X > 640
Stars(i)\X = 0
EndIf

       DisplaySprite3D(50, Stars(i)\X, Stars(i)\Y, Stars(i)\Shade)
Next 
   
   
   ;#### This displays the Arcane logo

DisplaySprite3D(0,(640-(SpriteWidth(0))*2)/2,140)
   
    Stop3D() 



; #### This draws the upper and lower borders

  StartDrawing (ScreenOutput())                       
   
   
   Box(0,104,640,2,#White)
   Box(0,392,640,2,#White)
   
  StopDrawing()                                       



 ; #### This draws the scroller
 
       cco = 0

  For cc = 0 To 20
    letter   = Asc(UCase(Mid(t.s, tptr+cc, 1)))-31
 
    yCharPos = letter / 10
    xCharPos = letter % 10
   
      If xcharpos= 0: xcharpos = 10 : ycharpos=yCharPos-1  :EndIf
    If xCharPos <- 1: xCharPos = 9
 
    ElseIf xCharPos > 0  : xCharPos = xCharPos - 1
    EndIf
   
      ClipSprite(1, xCharPos*32, yCharPos*44, 32,44)
   
   
     DisplayTransparentSprite(1, (sco+cco),312)
 
   
    cco = cco + 34
  Next
 
     
  sco = sco -4
   
  If sco < -32
    tptr = tptr + 1
    sco = sco + 32
  EndIf
     
  If tptr > Len(t.s)-16
    tptr = 0
  EndIf



 TimeGap = TimerDuration - (ElapsedMilliseconds() - Timer)

  If TimeGap > 16
 
    Delay( TimeGap - 10 )
  EndIf


  ExamineKeyboard()

  FlipBuffers()                                       

Until KeyboardPushed (#PB_Key_Escape)               

 
 ;#### If [ESC] was pressed stop the music
 
 MiniFmod_Stop()
 MiniFmod_Free()


 ;#### and Adios!
End

DataSection
font: IncludeBinary "font.bmp"
logo: IncludeBinary "arcane.bmp"
mod: IncludeBinary "return_of_egic.xm"
endmod:
EndDataSection
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: energy on January 20, 2012
nice one!   :D
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: Hotshot on January 20, 2012
Good One :)
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: Pot Noodle on January 21, 2012
Thanks for sharing, This will help me get to grips with Pb  :goodpost:
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: ttemper on January 21, 2012
nice one padman.

thanks for sharing the source code also.
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: padman on January 22, 2012
 :) @ all.
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: Raizor on January 22, 2012
Groovy :)
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: Kirl on January 23, 2012
Nice, cool font! :clap:
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: jace_stknights on January 24, 2012
 :clap:

Still making remakes????  shame on me :boxer:
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: padman on January 26, 2012
Cheers guys!  :)

Code: [Select]
Still making remakes?
Not really mate, I had some sparetime and was a little bored. Stormbringer's version is on RR since ages already...   ;)
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: jace_stknights on January 27, 2012
Hum... yep but you did it! not me  :boxer:

I will do my best to finish the Empire intro soon, just have to make the sinewave scroll... about 10 min of code  :-[
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: va!n on March 14, 2012
Nice one and thanks for sharing the source ;)
Title: Re: Arcane Cracktro Remake + Purebasic Source Code
Post by: benny! on March 14, 2012
Ooops ... totally missed this thread. Well done! And K++ for sharing the source!