@TheComet: Huh! It works! Thank you,
Comet for setting me straight. Interesting how I had to switch the X- and Y-coordinate variables out to make it work - perhaps I've got the variables holding the wrong coordinates?
All I did in addition to that was add 90 degrees to the answer the ATANFULL command gave and it made the enemy rotate to the player correctly (not adding ninety degrees caused the enemy's rotation to be ninety degrees off to the left).
edist1x = plrx - 32
edist1y = plry - 32
rotangle = atanfull(edist1y, edist1x) + 90
rotate sprite 2, rotangle
So now that this challenge is resolved, I'm trying to decide which direction I should take this program in now. Do I want to give the player and enemy shooting capabilities? Should I figure out how to make multiple sprites use the same code to always rotate to the player? Which direction would all of the more experienced coders here recommend I go in?
Thank you all!
Captain Coder
EDIT: I decided to try cloning sprites and then make them
all rotate to the player using code I had. It is a success! Here is what I ended up writing:
Sprite cloning:
rem clone enemy sprites!
for num = 3 to 5
clone sprite 2, num
NEXT num
sprite 3, 50, 50, 2
sprite 4, 100, 100, 2
sprite 5, 150, 150, 2
Sprite rotation:
rem make enemy sprites rotate to plr
for r = 2 to 5
sx = sprite x(r)
sy = sprite y(r)
edistx = plrx - sx
edisty = plry - sy
rotangle = atanfull(edisty, edistx) + 90
rotate sprite r, rotangle
NEXT r
My first use of the FOR loop, I might add
As a believer in Jesus Christ, I am trying to use my passion for game creation for His glory.