TGC Codebase Backup



CREATE ANIMATED SPRITE command loading bar, no media needed. by HowDo

5th Jun 2005 4:21
Summary

small demo on how to make grab and display a loading bar for your porject.



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Project: loadingbar
Rem Created: 6/3/2005 3:46:47 PM

Rem ***** Main Source File *****
rem Standard Setup Code
sync on : sync rate 0 :
backdrop on
color backdrop rgb(0,0,0)
 hide mouse
set text font "arial"
 set text size 20
  set text transparent

set image colorkey 0,0,0



for j=0 to 14
   cls
   rem black box
   box 0,0,250,32,RGB(0,0,0),RGB(0,0,0),RGB(0,0,0),RGB(0,0,0)
   rem yellow box
   box 2,2,248,30,RGB(255,255,0),RGB(255,255,0),RGB(255,255,0),RGB(255,255,0)
   rem black box
   box 4,4,246,28,RGB(0,0,0),RGB(0,0,0),RGB(0,0,0),RGB(0,0,0)
      rem makes a green block if i and j are the same number
      for i=0 to 14
         if i=j then ink rgb(0,255,0),0 else ink RGB(0,0,0),0
         box 6+(i*14)+(i*2),6,20+(i*16),26
      next i
   get image j+1,2,2,250,30
   ink rgb(255,255,255),0
   center text screen width()/2,300," Grab image "+str$(j)
   center text screen width()/2,320,"get image "+str$(j)+",2,2,250,30"
   sync
   wait 1000

   lx=247
   k=0
   b=29
next j
sync
rem 1
paste image 1,0,k:paste image 2,lx,k
inc k,b
rem 2
paste image 3,0,k:paste image 4,lx,k
inc k,b
rem 3
paste image 5,0,k:paste image 6,lx,k
inc k,b
rem 4
paste image 7,0,k:paste image 8,lx,k
inc k,b
rem 5
paste image 9,0,k:paste image 10,lx,k
inc k,b
rem 6
paste image 11,0,k:paste image 12,lx,k
inc k,b
rem 7
paste image 13,0,k:paste image 14,lx,k
inc k,b
rem 8
paste image 15,0,k:paste image 14,lx,k
inc k,b
rem 9
paste image 13,0,k:paste image 12,lx,k
inc k,b
rem 10
paste image 11,0,k:paste image 10,lx,k
inc k,b
rem 11
paste image 9,0,k:paste image 8,lx,k
inc k,b
rem 12
paste image 7,0,k:paste image 6,lx,k
inc k,b
rem 13
paste image 5,0,k:paste image 4,lx,k
inc k,b
rem 14
paste image 3,0,k:paste image 2,lx,k
inc k,b

center text screen width()/2,410,"Grab all above and put it into image 1. and then save it"
get image 16,0,0,493,k
sync
wait 2000

DELETE file "loadingbar.bmp"

save image "loadingbar.bmp",16
cls
wait 100

CREATE ANIMATED SPRITE 1,"loadingbar.bmp", 2,14,28
tl=text width("Loading.....")/2
sprite 1,200,240,2


do
ink rgb(255,255,255),0
if val(mid$(str$(timer()),5))>0 then text screen width()/2-tl,200,"Loading."
if val(mid$(str$(timer()),5))>2 then text screen width()/2-tl,200,"Loading.."
if val(mid$(str$(timer()),5))>4 then text screen width()/2-tl,200,"Loading..."
if val(mid$(str$(timer()),5))>6 then text screen width()/2-tl,200,"Loading...."
if val(mid$(str$(timer()),5))>8 then text screen width()/2-tl,200,"Loading....."
if val(mid$(str$(timer()),7))>8
play sprite 1,1,28,150
endif
sync

loop