Hello, I thought I would make one centeral topic for the questions I inevitably have, right now I am uncertain as to why my oponent sphere is only moving away from my blasts once, here is my code (sorry if it is confusing)
bullets = 0
autocam off
enemytop = 1
sync on
Do
if Button(20,55,"New Game")=1 then Goto New_Game
If Button(20,135,"Exit")=1 then End
sync
loop
New_Game:
cls
hide mouse
Text 240,220,"Get Ready to Play";
wait 2000
make object box 1,10,20,10
position object 1,0,0,0
color object 1,RGB(200,0,0)
make object box 2,14,600,292.5
position object 2,0,screen height()/2,236
make object box 3,14,600,292.5
position object 3,0,screen height()/2,-236
make object box 4,14.1,300,468
position object 4,0,372,0
make object box 5,14,186,5
position object 5,0,0,87.5
make object box 6,14,186,5
position object 6,0,0,-87.5
color object 6,RGB(200,200,0)
color object 5,RGB(200,200,0)
color object 4,RGB(200,200,0)
color object 2,0
color object 3,0
make object sphere 7,5
color object 7,RGB(0,200,10)
position object 7,0,160,0
etx# = object position x(7)
etz# = object position z(7)
ety# = object position y(7)
ets# = 1.5
position camera 180,-70,0
point camera 0,80,0
gamestart = 1
do
Rem Controls
position object 1,0,0,z#
if leftkey()=1 then z#=(z#-2.5)
if rightkey()=1 then z#=(z#+2.5)
if z#>80 then z#=80
if z#<-80 then z#=-80
Rem Enemy
position object 7,etx#,ety#,etz#
if bullet0 = 1
posneg = rnd(1)
if posneg = 0
if 7.5 > ABS(etz# - bz#)
mar = 1
if moving = 0 then moving = 1
endif
endif
if posneg = 1
if 7.5 > ABS(etz# - bz#)
mal = 1
if moving = 0 then moving = 1
endif
endif
endif
if moving = 0
mar = 0
mal = 0
endif
if mal = 1
etz# = (etz# - 1)
moving = (moving + 1)
endif
if mar = 1
etz# = (etz# + 1)
moving = (moving + 1)
endif
if moving = 8 then moving = 0
Rem Firing control
if upkey()=1
if bullets = 0
if limit = 0
make object cube 100,2
bullets = 1
position object 100,0,12,z#
bz# = object position z(100)
rotate object 100,270,0,0
bullet0 = 1
endif
endif
if bullets = 1
make object cube 101,2
bullets = 2
position object 101,0,12,z#
rotate object 101,270,0,0
bullet1 = 1
endif
endif
if bullets = 2
make object cube 102,2
limit = 1
position object 102,0,12,z#
rotate object 102,270,0,0
bullet2 = 1
bullets = 3
endif
Rem Checks to delete the bullets when they leave the play area
if bullet0 = 1
move object 100,10
if object position y(100) > 220
delete object 100
bullet0 = 0
limit = 0
endif
endif
if bullet1 = 1
move object 101,10
if object position y(101) > 220
delete object 101
bullet1 = 0
endif
endif
if bullet2 = 1
move object 102,10
if object position y(102) > 220
delete object 102
bullet2 = 0
endif
endif
if bullets = 3 then bullets = 0
sync
loop
function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed
"I wonder who said this..."