why won't the spheres move i've tried to find out but i cant.
sync on:sync rate 30
color backdrop rgb(50,50,255)
ink rgb(0,0,0),rgb(0,0,0)
randomize timer()
dim key(256)
type enem
health as integer
startx as integer
startz as integer
endx as integer
endz as integer
move as integer
scale as integer
endtype
dim enemy(100) as enem
make object box 9,500,4,500
move object down 9,5
color object 9,rgb(100,255,100)
for a=10 to 100
make object sphere a,3,6,6
position object a,rnd(1000),0,rnd(1000)
color object a,rgb(255,0,0)
enemy(a).health=100
enemy(a).startx=object position x(a)
enemy(a).startz=object position z(a)
enemy(a).endx=object position x(a)+rnd(60)
enemy(a).endz=object position z(a)+rnd(60)
enemy(a).scale=100
next a
load object "dwarf1.x",1
scale object 1,50,50,50
set object ambient 1, 0
set object speed 1, 30
loop object 1, 327, 360
playerhealth=100
`This is needed for the health bar Gothboy
max_hp = 100
do
`Gothboy, this is very easy, I just inserted Tifu's code and it worked perfectly
`It's just you needed the max_hp variable
`first, set the colour to white
INK RGB(0,0,0),0
` now, draw the background box. White box, at bottom of screen, which will be as big as the 'maxhealth' variable
box 0,440,max_hp+1,460
` now for your actual health, colour change to red
INK RGB(250,0,0),0
` and then draw a box, 1 pixel smaller than the previous one in each direction (so that the white box will be an outline) and this box is as long as your health bariable
box 1,441,playerhealth,459
`End Healthbar
if upkey()=1
move object 1,1,
loop object 1, 2, 14
endif
if downkey()=1
move object 1,-1,
loop object 1, 2, 14
endif
if leftkey()=1
loop object 1, 2, 14
yrotate object 1,object angle y(1)-5
endif
if rightkey()=1
loop object 1, 2, 14
yrotate object 1,object angle y(1)+5
endif
if returnkey()=1 and attack=0
attack=16
endif
if attack>0
attack=attack-1
loop object 1, 112, 126
for a=10 to 100
if object exist(a)=1
if object collision(1,a)=1
enemy(a).health=enemy(a).health-30
enemy(a).scale=enemy(a).scale-20
scale object a,enemy(a).scale,enemy(a).scale,enemy(a).scale
endif
if enemy(a).health<10
delete object a
endif
endif
next a
endif
if attack=1
for a=10 to 100
if object exist(a)=1
if distance(1,a)>50
patrol(a)
else
if object collision(a,1)=1
playerhealth=playerhealth-5
move object a,-15
endif
endif
endif
next a
endif
position camera (object position x(1)-sin(object angle y(1))*10),object position y(1)+4,(object position z(1)-cos(object angle y(1))*10)
point camera object position x(1),object position y(1),object position z(1)
text 1,1,str$(playerhealth)
sync
loop
function patrol(object)
if threeD_distance(object position x(object),enemy(object).endx,0,0,object position z(object),enemy(object).endz)<2 then enemy(object).move=1
if threeD_distance(object position x(object),enemy(object).startx,0,0,object position z(object),enemy(object).startz)<2 then enemy(object).move=0
if enemy(object).move=0
point object object,enemy(object).endx,0,enemy(object).endz
move object object,1
endif
if enemy(object).move=1
point object object,enemy(object).startx,0,enemy(object).startz
move object object,1
endif
endfunction
function distance(obj1,obj2)
dist=sqrt(((object position x(obj1)-object position x(obj2))*(object position x(obj1)-object position x(obj2)))+((object position z(obj1)-object position z(obj2))*(object position z(obj1)-object position z(obj2))))
endfunction dist
FUNCTION threeD_distance(x1# AS float, x2# AS float, y1# AS float, y2# AS float, z1# AS float, z2# AS float)
temp = 1
null = make vector3(temp)
set vector3 temp, x1# - x2#, y1# - y2#, z1# - z2#
length_vector = abs(length vector3(temp))
null = delete vector3(temp)
ENDFUNCTION length_vector
function keyready(keyz)
vl=0
if keystate(keyz)=1 and key(keyz) = 0
key(keyz) = 1
vl=1
endif
if keystate(keyz)=0
key(keyz) = 0
vl = 0
endif
endfunction vl