Author Topic: My First Demo  (Read 4657 times)

0 Members and 1 Guest are viewing this topic.

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 121
  • Karma: 4
    • View Profile
My First Demo
« on: October 30, 2015 »
Okay this is More Vomit Inducing than i wanted it to be  ;D But it puts together what ive learned thus far
Okay its not Original, Yes Ive coppied lots of code, but i had to put it all together and i can asure you it was a pain  :clap:
I promise, if i dont go to jail on monday for driving without a license, ill make a ripper but simple demo

Code: [Select]
resX = 800
resY = 600
xres = 320
yres = 240
sco   = 0
tptr  = 1

                         

UseJPEGImageDecoder()
UsePNGImageDecoder()
InitSprite()
InitKeyboard()
OpenScreen( resX, resY, 32, "MyFirstDemo" )
ipt = LoadSprite(#PB_Any, "C64.jpg")
If InitSound() = 0
MessageRequester("Error", "Sound system not available.") : End
EndIf
If CatchMusic(0, ?Tune, ?TuneEnd-?Tune)
  PlayMusic(0)
  ; Now, perform a nice fading...
  ;load font
  font = LoadSprite (#PB_Any, "Charset-DNS_Antor Intruders Font 3.png")                ; Load th$e font PNG as Sprite

If font = 0                                              ; If loading Spritefailed,
  MessageRequester("Error", "Cant load font.PNG", 0)     ; we alert an error and
  End             
 
  ; stop the application
EndIf
h$ = "                   "
h$ = h$ + "      WELL HERE IT IS   MY FIRST DEMO EVER IT WILL INDUCE SICKNESS  "
h$ = h$ + "I KNOW ITS A CUT AND PASTE JOB BUT I CAN HONESTLY SAY "
h$ = h$ + "IT WAS FAR HARDER THAN THAT, I ACTUALLY LEARNED SOMETHINGS     "
h$ = h$ + " OKAY WELL NOW THE THANKYOU TIME    THANKS TO PADMAN, WITHOUT YOU THIS WOULDNT HAVE HAPPEN   "
h$ = h$ + " THANKS TO SHOCKWAVE FOR HIS AWSOME SCROLLER, VAIN FOR FLOOR ROOTINE    AND TO http://www.dbfinteractive.com                                            "
Repeat
   
  ExamineKeyboard() 
 
  StartDrawing(ScreenOutput())
 camY.f = camY  + 200
    b.f = 0
    For y = 0 To resY-1
        w.f = -yres / y
        v.f = (  resX * w - camY )
        u.f = ( -xres * w + camX )
        For x = 0 To resX -1
            t =  ((Int(u) ! Int(v) ) & 255 )
            c = Int((t / resY) * y)
            Plot( x, y, RGB( c, c, c ))
            u = u + w
        Next
        b = b + resX
      Next
     
      StopDrawing()
      TransparentSpriteColor(ipt,#White)
     
       
      ;scroller
      cco = 0

       For cc = 0 To 25
     letter   = Asc(UCase(Mid(h$, tptr+cc, 1)))-32
 
    yCharPos = letter / 10
    xCharPos = letter % 10

             
    ClipSprite(font, xCharPos*32, yCharPos*32, 32, 32)   ;the magic
    TransparentSpriteColor(font,#Black)  ;sets the transparacy color of the font png
    DisplayTransparentSprite(font, sco+cco, 300+50*Sin((cc+cco+sco+m)/120))  ;
    DisplayTransparentSprite(ipt, 0, 0)
    cco = cco + 32
  Next
   m   = m   -5
  sco = sco -6
;     
  If sco < -32
    tptr = tptr + 1
    sco = sco + 32
  EndIf
;     
  If tptr > Len(h$)-30
    tptr = 1
  EndIf
 
   
  FlipBuffers()
  ClearScreen($0)
   Until KeyboardPushed( #PB_Key_Escape )
   For k=100 To 0 Step -1
      Delay(20)
      MusicVolume(0, k)
      End
    DataSection
    Tune:
 IncludeBinary "simpukka_chilli.xm"   ; no need to convert it to DATA statments using bin2data, just include the file.
TuneEnd:
 EndDataSection
Next
StopMusic(0)
EndIf
« Last Edit: October 30, 2015 by Omnikam »

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: My First Demo
« Reply #1 on: November 01, 2015 »
For your first Demo? That is good and Well Done  :clap:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: My First Demo
« Reply #2 on: November 01, 2015 »
Yep, much better than my first try  ;D
Keep coding, you are on the right way.
Challenge Trophies Won:

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 121
  • Karma: 4
    • View Profile
Re: My First Demo
« Reply #3 on: November 01, 2015 »
Oh wow thanks guy`s, I cant belive you say such kind thing, I felt rather ashamed of it because i rushed it out the door, i would have liked to spend a few days rather a night working on it. But im not going to rush my second one. I`m just glad you are giving up some of your time to help me with  the basics  :cheers:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1217
  • Karma: 230
    • View Profile
    • Homepage
Re: My First Demo
« Reply #4 on: November 03, 2015 »
Nice one Omnikam!  8)
A little vomit is good, it's tradition.  :)
www.kirl.nl
Challenge Trophies Won:

Offline KrazyK

  • Amiga 1200
  • ****
  • Posts: 390
  • Karma: 131
    • View Profile
    • KrazyK Remakes
Re: My First Demo
« Reply #5 on: November 03, 2015 »
Nice first effort.
Just a couple if tips from another PB coder for this demo though:
You only need to set the transparency once after you load the images.
And you can display the c64 image outside at the end of the scroller display loop rather than display it 25 times per loop.

Keep going though and trying other pieces of code as that's how most of us started.   :)
Challenge Trophies Won:

Offline Omnikam

  • Atari ST
  • ***
  • Posts: 121
  • Karma: 4
    • View Profile
Re: My First Demo
« Reply #6 on: November 03, 2015 »
Thanks for the feedback  :) Ill defiantly make those changes.
Ive started on another demo, but this time i only use in it what i know, so no flashy coding, but it`s fun and nearly all me lol
http://www.dbfinteractive.com/forum/index.php?topic=6481.msg82859#new