added walls, improved ai and added a boss, getting weird effects at the outlines of the bitmap objects anyone know about that stuff?
+ Code SnippetRem Project: fist fighting champion
Rem Created: tuesday, 10 march, 2020
sync on
rem enemy object
make object box 2,25,85,0.025
make object box 3,25,85,0.025
make object box 33,25,85,0.025
make object box 10,25,85,25
position object 10,530,45,510
load image "enemystance1.bmp",1
load image "enemypunch1.bmp",2
load image "enemypunch2.bmp",3
load image "enemypunch3.bmp",4
load image "bossenemy.bmp",8
load image "bossenemy2.bmp",9
load image "bossenemy3.bmp",10
load image "fist.bmp",5
SET OBJECT 2, 1, 1,1,1
texture object 2,1
SET OBJECT 3, 1, 1,1,1
texture object 3,5
SET OBJECT 33, 1, 1,1,1
texture object 33,8
position object 33,530,45,610
rem create walls
make object box 20,400,100,0.025 : position object 20,500,50,300
make object box 21,400,100,0.025 : position object 21,500,50, 700
make object box 22,0.025,100,400 : position object 22,300,50,500
make object box 23,0.025,100,400 : position object 23, 700,50,500
for t=20 to 23
SET OBJECT t, 1, 1,1,1
color object t,rgb(0,0,0)
next t
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
maximize window
sync rate 0
position camera 0, 500,100,500
camspeed = 2
camheight = 100
xpos = camera position x(0)
zpos = camera position z(0)
do
position object 2,object position x(10),object position y(10),object position z(10)
yrotate object 10,wrapvalue(rnd(360)/(rnd(3)+1))
mv=mv+1
if mv=>3000
move object 10,0.025
endif
if mv=>4000 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)
rem enemy intelligence
if distance#=<255 then attack#=1
if attack#=1
zhxz=zhxz+1
if zhxz=>100 and zhxz<600 then texture object 2,3
if zhxz=>600 and zhxz<700 then texture object 2,2
if zhxz=>700 and zhxz<800 then texture object 2,4
if zhxz=>801 then zhxz=0
else
zhxz=0
attack#=0
texture object 2,1
endif
zhxza=zhxza+1
if zhxza=>100 and zhxza<600 then texture object 33,8
if zhxza=>600 and zhxza<700 then texture object 33,9
if zhxza=>700 and zhxza<800 then texture object 33,10
if zhxza=>801 then zhxza=0
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 3, object position x(6),77, object position z(6)
yrotate object 3,wrapvalue(object angle y(6)-180)
set object to camera orientation 3
if spacekey()=1
atk=atk+1
if atk=>300 then move object 3,18.5
if atk=>600
position object 3, object position x(6),77, object position z(6)
atk=0
endif
endif
if spacekey()=1 and 1=object collision(10,6) and atk=>300
yrotate object 10,wrapvalue(ATANFULL(distx, disty)-180)
move object 10,0.85
endif
for nmz = 20 to 23
if 1=object collision(10,nmz)
position object 10, object position x(10), object position y(10), object position z(10)
yrotate object 10,-180
move object 10,-1.5
endif
next nmz
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#)
sync
loop