Main Menu

Vampire Demo (16bit)

Started by kevin, September 07, 2016, 12:27:09 AM

Previous topic - Next topic

kevin

 Vampire Demo (Amiga)

 This example is really shows how to use palette mapping to do pixel format conversions from 16bit to 32bit.   The all artwork is 16bit, and before you ask i've no idea what it from..  It was just sent to me a while back..  Meant to post this earlier, but forgot :)


PlayBASIC Code: [Select]
      path$="Gfx\"


startTime=Timer()

ThisFILE$ =Path$+"back-2-BE.bmp"
BackDropIMAGE =ReadBM(ThisFILE$,1)


Type tAnim
FileName$
Width
Height
Count
Frames(64)
EndType

DIm Anim(100) as tAnim


Type tSprite
X#,Y#
SpeedX#
AnimIndex
FrameIndex#
FrameSpeed#
EndType

Dim Sprite as tSprite LIst



AnimTimeInFrames = 100

// --------------------------------------------------------------
// ----[ KNIGHT ] -----------------------------------------------
// --------------------------------------------------------------


Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-1-BE.bmp",259)
Sprite.X# =100
Sprite.Y# =480
Sprite.SpeedX# = 1
Sprite.FrameSpeed# = 0.2
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames*1.20 )




// --------------------------------------------------------------
// ----[ AMAZON ] -----------------------------------------------
// --------------------------------------------------------------

Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-2-BE.bmp",248)
Sprite.X# =250
Sprite.Y# =480
Sprite.SpeedX# = 1.4
Sprite.FrameSpeed# = 0.20
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames )




// --------------------------------------------------------------
// ----[ WIZARD ] --------------------------------------------------
// --------------------------------------------------------------

Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-3-BE.bmp",216)
Sprite.X# =400
Sprite.Y# =480
Sprite.SpeedX# = 0.8
Sprite.FrameSpeed# = 0.20
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames )


// --------------------------------------------------------------
// ----[ ELF ] --------------------------------------------------
// --------------------------------------------------------------

Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-4-BE.bmp",240)
Sprite.X# =550
Sprite.Y# =480
Sprite.SpeedX# = 1
Sprite.FrameSpeed# = 0.20
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames )



// --------------------------------------------------------------
// ----[ DWARF ] --------------------------------------------------
// --------------------------------------------------------------

Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-5-BE.bmp",187)
Sprite.X# =700
Sprite.Y# =480
Sprite.SpeedX# = 1.2
Sprite.FrameSpeed# = 0.20
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames)



// --------------------------------------------------------------
// ----[ DWARF ] --------------------------------------------------
// --------------------------------------------------------------

Sprite = New tSprite
Sprite.AnimIndex =NewAnim(Path$+"walk-6-BE.bmp",214)
Sprite.X# =850
Sprite.Y# =480
Sprite.SpeedX# = 1.5
Sprite.FrameSpeed# = 0.20
Sprite.FrameSpeed# = AnimSpeed(Sprite.AnimIndex,AnimTimeInFrames)

#print "Total LOAD TIME:"+STR$(Timer()-StartTime)+" Milliseconds"

SetFps 60


; ---------------------------------------------------
Do
; ---------------------------------------------------

DrawImage BackDropIMAGE,XPOS,0,false
DrawImage BackDropIMAGE,XPOS-GetImageWidth(BackDropIMAGE),0,false

XPOS = wrapvalue(XPOS-1,0,GetImageWidth(BackDropIMAGE))

For Each Sprite()

// Get the animation this sprite is using
AnimIndex =Sprite.AnimINDEX

// Move the animation forward
FrameIndex#=Sprite.FrameIndex#
Frame =Anim(AnimIndex).Frames(Floor(FrameIndex#))
Sprite.FRameIndex# =mod( FrameIndex# + Sprite.FRameSpeed# , Anim(AnimIndex).count)

// Move sprite forward (Right to left)
x#=mod(Sprite.X#+Sprite.SpeedX#, GetScreenWidth()+200)
Sprite.X#=x#
X#=X#-(GetImageWidth(Frame)/2)-100
Y#=Sprite.Y#-(GetImageHeight(Frame))
Login required to view complete source code



Video





 Download

      Download  Vampire Demo (login required)


kevin

 Put a video of this on youtube.