Scorpyo wrote: "hope it helps"
yes I have saved your advice to my code base, I will show you my open source code so far, at this point in time i have a problem of bursting out of a room randomly when moving forwards, i also have a translocating ball to place wounds, this stuff wasn't easy to get, it's got old stuff to it like offsetting from limb 0 to appoint a head on a neck, really intricate stuff?
Rem Project: fist fighting champion
Rem Created: tuesday, 10 march, 2020
sync on
rem enemy object
hide mouse
color backdrop rgb(0,0,0)
make object box 2,25,100,0.025
make object box 3,25,85,0.025
make object box 10,25,85,25
position object 10,530,45,510
hide object 3
load image "stone.bmp",11
load image "wall4.bmp",18
rem create walls
make object box 20,400,200,0.025 : position object 20,500,50,300
make object box 21,400,200,0.025 : position object 21,500,50, 700
make object box 22,0.025,200,400 : position object 22,300,50,500
make object box 23,0.025,200,400 : position object 23, 700,50,500
make object box 24,600,0.025,600 : position object 24, 500,-30,500
make object box 25,600,0.025,600 : position object 25, 500,100,500
for tk=20 to 25
SET OBJECT tk, 1, 1,1,1
texture object tk,11
next tk
texture object 21,18
rem skullmarine object
load object "ninja.x",177
scale object 177,4000,5800,4800
hide limb 177,11
hide limb 177,4
load image "skullmarine.bmp",88
make object sphere 89,10
scale object 89,20,25,20
xrotate object 89,21
offset limb 89,0,0,3,-2
texture object 89,88
yrotate object 89,33
GLUE OBJECT TO LIMB 89, 177, 4
position object 177,580,-10,540
load image "skullyarmor.bmp",78
for pxz=0 to 17
texture limb 177,pxz,78
next pxz
load image "bone.bmp",65
texture limb 177,2,65
texture limb 177,13,65
texture limb 177,16,65
rem wound
load image "flesh.bmp",89
make object sphere 155,25
color object 155,rgb(255,0,0)
rem player object
load object "ninja.x",48
scale object 48,4000,5800,4800
hide limb 48,11
hide limb 48,4
hide limb 48,3
#CONSTANT knife 55
#CONSTANT handle 1
#CONSTANT blade 2
#CONSTANT point 3
make object box knife, 5, 7 , 3
position camera 0,0,-20
rem attach a handle
make object box 77,3.4,3.5, 3.7
make mesh from object handle,77
delete object 77
add limb knife,handle,handle
offset limb knife,handle, 0,-2.5,0
rem attach a blade
make object box 77,5.7 ,26, 5.25
scale object 77,23,50,10
make mesh from object blade,77
delete object 77
add limb knife, blade, blade
link limb knife, handle, blade
offset limb knife, blade, 0,2.0,0
rem attach a point
make object box 77,1.25 ,1.25, 1.25
scale object 77,80,80,43
zrotate object 77,45
make mesh from object point,77
delete object 77
add limb knife, point, point
link limb knife, blade, point
offset limb knife, point, 0,8.6,0
scale object knife,20,20,20
xrotate object knife,-90
hide limb knife,0
load image "blade.bmp",16
load image "handle.bmp",17
texture limb knife,blade,16
texture limb knife,handle,17
texture limb knife,point,16
GLUE OBJECT TO LIMB knife, 177, 11
rem player knife
#CONSTANT knifetwo 56
#CONSTANT handletwo 1
#CONSTANT bladetwo 2
#CONSTANT pointtwo 3
make object box knifetwo, 5, 7 , 3
position camera 0,0,-20
rem attach a handle
make object box 77,3.4,3.5, 3.7
make mesh from object handletwo,77
delete object 77
add limb knifetwo,handletwo,handletwo
offset limb knifetwo,handletwo, 0,-2.5,0
rem attach a blade
make object box 77,5.7 ,26, 5.25
scale object 77,23,50,10
make mesh from object bladetwo,77
delete object 77
add limb knifetwo, bladetwo, bladetwo
link limb knifetwo, handletwo, bladetwo
offset limb knifetwo, bladetwo, 0,2.0,0
rem attach a point
make object box 77,1.25 ,1.25, 1.25
scale object 77,80,80,43
zrotate object 77,45
make mesh from object pointtwo,77
delete object 77
add limb knifetwo, pointtwo, pointtwo
link limb knifetwo, bladetwo, pointtwo
offset limb knifetwo, pointtwo, 0,8.6,0
scale object knifetwo,20,20,20
xrotate object knifetwo,-90
hide limb knifetwo,0
texture limb knifetwo,bladetwo,16
texture limb knifetwo,handletwo,17
texture limb knifetwo,pointtwo,16
GLUE OBJECT TO LIMB knifetwo, 48, 11
rem divamarine objects
load object "ninja.x",43
scale object 43,4000,5800,4800
remove limb 43,11
load image "max.bmp",12
make object sphere 44,10
scale object 44,20,25,20
xrotate object 44,21
offset limb 44,0,0,3,-2
texture object 44,12
GLUE OBJECT TO LIMB 44, 43, 4
hide limb 43,4
load image "ninja.bmp",66
texture object 43,66
load image "boot.bmp",15
texture limb 43,16,15
texture limb 43,13,15
load image "left.bmp",67
load image "crotch.bmp",68
make object sphere 88,33
scale object 88,12,8,5
glue object to limb 88,43,1
offset limb 88,0,0,-8,0
texture object 88,68
hide limb 43,1
load image "right.bmp",69
texture limb 43,12,67
texture limb 43,11,67
texture limb 43,15,69
texture limb 43,14,69
texture limb 43,8,69
texture limb 43,9,69
texture limb 43,5,67
texture limb 43,6,67
texture limb 48,12,67
texture limb 48,11,67
texture limb 48,15,69
texture limb 48,14,69
texture limb 48,8,69
texture limb 48,9,69
texture limb 48,5,67
texture limb 48,6,67
rem player colision
ObjectNumberF=6
MeshIndex1=2 : MeshIndex2=3 : MeshIndex3=4
make object cube 6,20 : make mesh from object MeshIndex1, 6 : delete object 6
make object cube 6,50 : make mesh from object MeshIndex3, 6 : delete object 6
make object cube 6,50 : scale object 6,30,30,300
make mesh from object MeshIndex2, 6 : delete object 6
make object box ObjectNumberF, 100,2,100
add limb ObjectNumberF, 1, MeshIndex1 : link limb ObjectNumberF, 0, 1
add limb ObjectNumberF, 2, MeshIndex2 : link limb ObjectNumberF, 1, 2
add limb ObjectNumberF, 3, MeshIndex2 : link limb ObjectNumberF, 2, 3
add limb ObjectNumberF, 4, MeshIndex3 : link limb ObjectNumberF, 3, 4
offset limb ObjectNumberF, 3, 0, 60, -120
offset limb ObjectNumberF, 4, 0, 0,0
position object ObjectNumberF,-100,0,0
make object sphere 2000, 5
make object box 1908, 33,150,33
maximize window
sync rate 0
camspeed = 2
camheight = 90
xpos = camera position x(0)
zpos = camera position z(0)
position camera 0,500,camheight,500
do
position object 1908,object position x(177),object position y(177)+20,object position z(177)
hide object 2
position object 2,object position x(10),25,object position z(10)
yrotate object 10,wrapvalue(rnd(360)/(rnd(3)+1))
position object 43,object position x(10),-20,object position z(10)
yrotate object 43,wrapvalue(object angle y(2)-180)
mv=mv+1
if mv=>30000 and ht=0
move object 10,0.025
endif
if mv=>40000 then mv=0
hide object 10
x1=object position x(2)
x2=camera position x()
y1=object position y(2)
y2=camera position y()
z1=object position z(2)
z2=camera position z()
distx = ( x2 - x1 ) * ( x2 - x1 )
disty = ( y2 - y1 ) * ( y2 - y1 )
distz = ( z2 - z1 ) * ( z2 - z1 )
distance# = sqrt( distx + disty + distz )
yrotate object 2,wrapvalue(ATANFULL(distx, disty)-180)
camRotY = wrapvalue(camera angle y(0)+ mousemovex()*0.8)
camRotX = wrapvalue(camera angle x(0)+ mousemovey()*0.8)
hide object 6
position object 6, camera position x(),45, camera position z()
yrotate object 6,wrapvalue(camera angle y()-180)
position object 48, object position x(6),-13, object position z(6)
yrotate object 48,wrapvalue(object angle y(6)-13)
set object to camera orientation 3
if spacekey()=1
ROTATE LIMB 48, 8, 0, camera angle x()*.8-180, 13
ROTATE LIMB 48, 9, 0, camera angle x()*.8-180, 13
azx=azx+1
if azx=>300
offset limb 48,9,0.75,0,0
endif
if azx=>400
offset limb 48,9,-0.75,0,0
azx=0
endif
endif
for nmz = 20 to 21
if 1=object collision(10,nmz)
position object 10, object position x(10), object position y(10), object position z(10)
yrotate object 10,wrapvalue(-360)
ht=1
else
ht=0
endif
next nmz
for nmzi = 22 to 23
if 1=object collision(10,nmzi)
position object 10, object position x(10), object position y(10), object position z(10)
yrotate object 10,wrapvalue(-360)
ht=1
else
ht=0
endif
next nmzi
if upkey()=1
inc xpos, sin(camRotY)*camspeed
inc zpos, cos(camRotY)*camspeed
position camera xpos,camheight,zpos
endif
if downkey()=1
dec xpos, sin(camRotY)*camspeed
dec zpos, cos(camRotY)*camspeed
position camera xpos,camheight,zpos
endif
if leftkey()=1
dec xpos, sin(camRotY+90)*camspeed
dec zpos, cos(camRotY+90)*camspeed
position camera xpos,camheight,zpos
endif
if rightkey()=1
dec xpos, sin(camRotY-90)*camspeed
dec zpos, cos(camRotY-90)*camspeed
position camera xpos,camheight,zpos
endif
rotate camera camRotX,camRotY,0
text 0,10,"dst = "+str$(distance#)
x#=camera position x()
z#=camera position z()
if spacekey()=1 and throw = 0
throw=1
tx# = x#
tz# = z#
ty# = 10
tYA# = camera angle y()
tPitch# = 360.0-camera angle x()
T# = 0.0
F# = 2.0
tpx# = 0
endif
if throw = 1
oldtpx#=tpx#
oldtx#=tx#
oldtz#=tz#
rem TPX# is the distance the object has traveled from the origin
TPX#=F#*COS(tPitch#)*T#
rem TPY# is the height of the object's arc.
TPY#=F#*SIN(tPitch#)*T#-(0.5*grav_str#)*(T#^2)
rem dist# is the distance that the object has traveled during this iteration
dis#=abs(oldtpx#-tpx#)
rem tx# and tz# transforms that distance from 2D into a 3D distance based
rem on the character's Y rotation.
tx#=newxvalue(tx#,tYA#,dis#)
tz#=newzvalue(tz#,tYA#,dis#)
rem increment time index
inc T#
rem positions the object
position object 2000,tx#,44,tz#
if T#=>25
throw=0
endif
set object collision to boxes 2000
set object collision to spheres 1908
endif
if object collision (2000,1908)=1
throw=0
position object 155,object position x(2000),object position y(knifetwo)+54,object position z(2000)
endif
sync
LOOP