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 some give me some help.. please with collision for this program

Author
Message
fussy123
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location:
Posted: 18th Oct 2002 01:07
hi... i have been trying to make a game like the sorcery game by paul jefferies.. i was doing not too bad i guess till i got hung up trying to get the collision to work properly.. i mean by that that when the player charc makes a jump and hit and object he doesnt get hung init as my program seems to be doing ...
this is the way i have set it up so far :
userinput:

userinput:
posx#=object position x(20)
posy#=object position y(20)
posz#=object position z(20)
playergrav#=playergrav#-0.1
posy#=posy#+playergrav#
if object collision(20,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
playergrav#=0
endif
position object 20 ,posx#,posy#,posz#



if rightkey()=1


if sound playing(1)=1

yrotate object 20,90
if obframe>30 then obframe=0
set object frame 20, obframe
MOVE OBJECT 20,1
obframe=obframe+1
return
else
yrotate object 20,90
if obframe>30 then obframe=0
set object frame 20, obframe
MOVE OBJECT 20,1
obframe =obframe +1
play sound 1
endif



endif


if leftkey()=1
if sound playing(1)=1

yrotate object 20,270
if obframe>30 then obframe=0
set object frame 20, obframe
MOVE OBJECT 20,1
obframe=obframe+1
return
else
yrotate object 20,270
if obframe>36 then obframe=0
set object frame 20, obframe
MOVE OBJECT 20,1
play sound 1
endif



endif




if upkey()=1 and playergrav#=0
playergrav#=2

endif
return


anyway that is the basic code i am using i also have set up object collision boxes for all the platforms and ledged i used in the program using:
for block=1 to 10
sx#=object size x(block)/2
sx#=object size x(block)/2
sx#=object size x(block)/2
make object collision box block,-1*sx#,-1*sy#,-1*sz#,sx#,sy#,sz#,0
next block

the problem i have is that when the player object jumps using upkey he gets if he collides with an upper block or ledge he hangs in it .. any one have any suggestion for me here?
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 19th Oct 2002 16:21
Put dec posy#,get object collision y()+.1 instead of the line you have. I bet it ends up with the two surfaces touching, triggering the collision routine again.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-04-20 02:03:50
Your offset time is: 2024-04-20 02:03:50