Can anybody implement an enemy in sight code without using sprite collisions in this code?
radarLineAngle# = 270
radarAngleIncrease# = 0.1
radarLineLength# = 200
screenWidth# = screen width()
screenHeight# = screen height()
Rem Make Sprite
circle 10,10,10
line 10,0,10,10
get image 1,0,0,21,21
sprite 1, screenWidth# / 2.0, screenHeight# / 2.0, 1
offset sprite 1, 10, 10
sprX# = screenWidth# / 2.0
sprY# = screenHeight# / 2.0
sprite 2,10,100,1 : offset sprite 2, 10, 10
enemyX# = sprite x(2)
enemyY# = sprite y(2)
sync on : backdrop on
do
sprA# = wrapvalue(sprA# + mousemovex())
rotate sprite 1, sprA#
if mouseclick() = 1
move sprite 1,1
endif
if mouseclick() = 2
move sprite 1,-1
endif
sprX# = sprite x(1)
sprY# = sprite y(1)
if radarLineAngle# => 405
radarAngleIncrease# = -0.2
endif
if radarLineAngle# =< 275
radarAngleIncrease# = 0.2
endif
radarLineAngle# = radarLineAngle# + radarAngleIncrease#
lx1# = sprX#
ly1# = sprY#
lx2# = lx1# + (sin(radarLineAngle# + sprA#)*radarLineLength#)
ly2# = ly1# - (cos(radarLineAngle# + sprA#)*radarLineLength#)
line lx1#, ly1#, lx2#, ly2#
rx2# = lx1# + (sin(radarLineAngle# + sprA# + 45)*radarLineLength#)
ry2# = ly1# - (cos(radarLineAngle# + sprA# + 45)*radarLineLength#)
line lx1#, ly1#, rx2#, ry2#
line lx2#, ly2#, rx2#, ry2#
sync
loop