Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / dbpro animation

Author
Message
the destroyer
15
Years of Service
User Offline
Joined: 24th Dec 2008
Location:
Posted: 30th Dec 2008 21:43
Hi can somebody tell me why doesn't my code work??
it doesn't play the character animation..
anyway here is my code
sync on
sync rate 60
hide mouse
autocam off




player=1
load object "media/hero/roomdemo.x",player
xrotate object player,-90
set object specular player,0
fix object pivot player
rotate object player,0,180,0
position object player,0,0,0
heroframe#=total object frames(player)/200.0
loop object player,0,39*heroframe#





ground=2
load image "media/ground/24.bmp",1
make object plain ground,10000,10000
xrotate object ground,90
position object ground,0,0,0
texture object ground,1
scale object texture ground,10,10

do
move=0

if move=0 then loop object player,0*heroframe#,39*heroframe#
if move=1 then loop object player,40*heroframe#,59*heroframe#

if rightkey () = 1 then yrotate object player,wrapvalue (object angle y(player)+4):move=1
if leftkey () = 1 then yrotate object player,wrapvalue (object angle y(player)-4): move=1
if upkey () = 1 then move object player,5 : move=1
if downkey () = 1 then move object player,-5 : move=1
if spacekey () = 1 and jumping#=0 then jump#=1

if jump#=1
ground#=object position y(player)
jump_speed#=3
jumping#=1
jump#=0
endif

if jumping#=1
DEC JUMP_SPEED#,.1

position object player,object position x(player),object position y(player)+jump_speed#,object position z(player)
if object position y(player)<=ground# then jumping#=0
endif


x as float
y as float
z as float
a as float
d as float
h as float
s as float

x = object position x(player)
y = object position y(player)
z = object position z(player)
a = object angle y(player)
d = 250.0
h = 185.0
s = 50.0

set camera to follow x,y,z,a,d,h,s,1

center text screen width()/2,screen height()/screen height(),"My first game"
sync
loop

please help me
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 31st Dec 2008 02:32 Edited at: 31st Dec 2008 02:38
You have the loop object command inside your loop, you don't need to call it every time like that, it just restarts the animation from the first frame.

You also seem to have a problem with which frames your trying to play.

I'm also sure u don't need to declare variables (i.e x as float) mid loop either, just once at the beginning, before the loop.

Indent your code as well, to make it neater and easier to read, and don't forget to comment stuff so people can tell what bits sposed to do what. (This is good practice in case you ever leave a project and come back to it later)

and please use code tags

Good effort tho

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
the destroyer
15
Years of Service
User Offline
Joined: 24th Dec 2008
Location:
Posted: 31st Dec 2008 13:10
haha okee thanks maan
i'll do it

Login to post a reply

Server time is: 2024-11-24 16:49:23
Your offset time is: 2024-11-24 16:49:23