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 / can someone look at this and see if they can help

Author
Message
fussy123
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location:
Posted: 6th Oct 2002 02:52
i am trying to make the knight be able to jump and still be able to catch a ride on the platforms ... i know its a messy code .. but oh well im a noob
any help would be appreciated:
sync on:sync rate 60
backdrop on
color backdrop 0
rem Setup direction array
dim arrayx(10)
blue=rgb(0,100,200)
orange=rgb(200,0,100)
load object "knight_walk.x", 21
scale object 21,1300,1300,1300
position object 21,0,-500,0

rem Create walls (and make them non-rotation collision boxes)
make object box 1,100,1300,100 : position object 1,-700,0,0:color object 1, blue
make object box 2,100,1300,100 : position object 2,700,0,0:color object 2, rgb(100,200,0)
make object collision box 1,-50,-650,-50,50,650,50,0
make object collision box 2,-50,-650,-50,50,650,50,0

make object collision box 21,-5,-5,-5,5,5,5,0

make object box 3,1400,100,100 :position object 3,0,-600,0:color object 3,orange
make object box 10,1400,100,100 :position object 10,0,600,0:color object 10, rgb(200,200,200)
make object collision box 3,-700,-50,-50,700,50,50,0

make object collision box 10,-700,-50,-50,700,50,50,0

rem Create boxes for bouncing

y=t*10
make object box 101,80,30,100
position object 101,rnd(200)-100,(t*46)-200,0
yrotate object 101,90:color object 101 ,orange

arrayx(t)=0

rem Load model to bounce off
do
rem Main loop
default$="4"





print "object collsion 101= ",object collision(101,0)
if dir36 then obframe=0
set object frame 21, obframe
MOVE OBJECT 21,3
obframe=obframe+1
if obframe>36 then obframe=0
set object frame 21, obframe
move object 21,3
obframe=obframe+1

endif

if leftkey()=1 and dir36 then obframe=0
set object frame 21, obframe
MOVE OBJECT 21,3
obframe=obframe+1
if obframe>36 then obframe=0
set object frame 21, obframe
move object 21,3
obframe=obframe+1
endif

endif

gosub collcheck

collresult=object collision(101,0)

gosub platform



s#=object size y(21)/2.0

center text 320,460," "+str$(screen fps())

rem Drop model into collision bounce zone



rem Update camera based on mouse position
position camera 0,0,-1300
point camera 0,0,0

rem Update screen
sync
rem End loop
loop




return

return
platform:

colresult=object collision(101,0)
if colresult>0
if colresult=3
rem Box is touching left wall, set box direction to right
dir=1
else
if colresult=10
rem Box is touching right wall, set box direction to left
dir=0
else
dir=dir-1
if dir 0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
playergrav#=0
endif




endif
if dir=1

position object 101,object position x(101),yval,object position z(101)
yval=yval+1
oldposx#=object position x(21)
oldposy#=object position y(21)
oldposz#=object position z(21)

posx#=object position x(21)
posy#=object position y(21)
posz#=object position z(21)
playergrav#=playergrav#-0.3
posy#=posy#+playergrav#
if object collision(21,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
playergrav#=0
endif

endif
if dir=2
set cursor 125,125
print "now is 2"
inc yval
posx#=object position x(21)
posy#=object position x(21)

posz#=object position x(21)



position object 101,object position x(21),yval,object position z(21)




position object 21,object position x(101),object position y(101),object position z(101)
endif


rem Check whether box is touching anything



return


return
collcheck:
if object hit(101,3) then bottomhit=bottomhit+1
if object hit(101,21) then knighthit=knighthit+1
if object hit(101,10) then tophit=tophit+1
if object hit(21,10) then headhit=headhit+1
return
LastOfTheBedroomCoders
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: United Kingdom
Posted: 8th Oct 2002 22:09
Hi there, you noob! ;o)

I'm new to DBpro myself, but I work in computer games as a Lead Artist and have done quite a bit of programming in C++ - mainly playing around, or writing plug-ins an' stuff...

So, I may be able to help out... I DID try compiling the attached code, but it had a few errors. Have you got a "working" version?

L8r...


LotBC

Login to post a reply

Server time is: 2024-11-23 16:23:19
Your offset time is: 2024-11-23 16:23:19