Qbasicnews.com
January 22, 2022, 08:59:45 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Demo of my Animation Engine  (Read 2163 times)
Lithium
Forum Regular
**
Posts: 123


« on: June 28, 2003, 09:52:23 AM »

http://lithium.zext.net/crap/test.zip
press 1-4 to animate the corrisponding arm

It's QB/C mix.. uses UGL.. I spent all last night working on it.. the sad thing is, I spent < 1 hour coding, and like 7 hours debugging.. ah... (/me sux)

here's what the code on QB side for the demo looks like:

Code:
dim ArmAnim(0 to 3) as long, ManAnim as long
 for i = 0 to 3
  ArmAnim(i) = AnimNew&(Set(0))
 next
 ManAnim  = AnimNew&(Set(1))

 AnimSwitch ManAnim, 0, 0, AF.LOOP

 while len(inkey$): wend
 do
  a = (curtime/100 * 45) mod 360
  z! = abs(sin(curtime/100))

  for i = 0 to 3
   AnimUpdate ArmAnim(i)
  next
  AnimUpdate ManAnim
  z2! = sin(curtime/100) * .1
  DrawAnim e.back, ArmAnim(0), 80, 50, 0, .5
  DrawAnim e.back, ArmAnim(1), 320-80, 50, 0, .5
  DrawAnim e.back, ArmAnim(2), 80, 150, 0, .5
  DrawAnim e.back, ArmAnim(3), 320-80, 150, 0, .5
  DrawAnim e.back, ManAnim,  160, 100, a, .8*z!
 
  wait &h3da, 8
  uglPut e.video, 0, 0, e.back
  uglClear e.back, uglColor(e.fmt, 0, 0, 0)

  k$ = inkey$
  if val(k$) >= 1 and val(k$) <= 4 then AnimSwitch ArmAnim(val(k$)-1), 0, 100, AF.DEFAULT
 loop until k$ = chr$(27)

 for i = 0 to 3
  AnimDelete ArmAnim(i)
 next
 AnimDelete ManAnim


here are the functon protos:
Code:
' Memory Routines
declare function fpalloc&       ( byval bytes as long )        
declare      sub fpfree         ( seg what as long )
declare      sub fpfreeall      ( )
' Set Routines
declare function SetNew&        ( filename as string, byval fmt as integer )
declare      sub SetDelete      ( seg theSet as long )
declare      sub SetWalkNodes   ( byval theSet as long, byval firstnode as integer )
declare function SetModel&      ( byval theSet as long, byval model as integer )
declare function SetObject&     ( byval theSet as long )
' Draw Routines
declare      sub DrawModel      ( byval dc as long, byval m as long, byval x as integer, byval y as integer, byval a as integer, byval hf as integer, byval vf as integer, byval z as single )
declare      sub DrawObject     ( byval dc as long, byval o as long, byval theSet as long, byval node as integer, byval x as single, byval y as single, byval a as integer, byval z as single )
declare      sub DrawAnim       ( byval dc as long, byval animState as long, byval x as integer, byval y as integer, byval a as integer, byval z as single )
' Animation Routines
declare function AnimNew&       ( byval theSet as long )
declare      sub AnimDelete     ( seg animState as long )
declare      sub AnimUpdate     ( byval animState as long )
declare      sub AnimSwitch     ( byval animState as long, byval animNo as integer, byval transtime as integer, byval flags as integer )
' Other Routines
declare function curtime&       ( )
Logged

COUNT HACKED BY RAZVEEE

RAZVEE IS A SCRIPT KIDDIE- hacker9
Dav
Administrator
Ancient Guru
*****
Posts: 709



WWW
« Reply #1 on: June 28, 2003, 11:11:33 AM »

Neat, Lithium.  Works very smooth for me here on low rez.  True color wouldn't init because my vid card is from the stone age.  Looks nice in low rez tho.

- Dav
Logged

Ryan
Wandering Guru
***
Posts: 338



WWW
« Reply #2 on: June 28, 2003, 11:23:19 AM »

Coolness.. worked very well in 16 Bit here.  Nice and smooth.  Cheesy

(btw, just played your Metadroid demo and thought it ruled, even with sound on.  = P  Really liked the battles, though I can't remember what Ultima battles were like.. I guess I only played the later ones.)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!