Hello,
The skulls follow a hidden sprite that point to the nearest enemy
function angle(spr,x1,y1,x2,y2)
posx#= (x1 - x2)
posy#= (y1 - y2)
angle#= atanfull(posx#,posy#)
setspriteangle(spr,angle#)
endfunction
rem spr is the sprite 1
rem x1 and y1 are the coordinates of sprite 1
rem x2 and y2 are the coordinates of sprite 2
-------------------------------------------------------------------------------------------
function Move(sprite,speed )
setSpritePositionByOffset(sprite,GetSpriteXByOffset(sprite)+sin(GetSpriteAngle(sprite))*speed,GetSpriteYByOffset(sprite)-cos(GetSpriteAngle(sprite))*speed)
endfunction
rem the sprite advances according to its angle !!
In the game, the skull runs in circles when there is no more target !
I do what i do !!!