Page 1 of 1

having an enemy rotate toward the payer

PostPosted: Sun Oct 26, 2008 2:20 am
by J Maker
yo, I am making a game wer the enemy needs to face the player and the enemy rotates 360, so if the player jumps, the direction the enemy is facing will move up 2, i have to code wer something does that for the mouse, but it doesn't work for the enemy, i tried changing the mose angles and stuff to player angles, but it still doesn't work. I have done this before except i can't get to my ged files of the other games for my codes, so im at a HUGE disadvantage. If anyone can help, please do becuse pretty much all of my enemies will be the way I described before.

Re: having an enemy rotate toward the payer

PostPosted: Sun Oct 26, 2008 11:30 am
by Kalladdolf
let's say your enemy actor animation has 45 frames.
put on draw actor:
Code: Select all
animpos = direction(x, y, player.x, player.y) / 8;  //  "/8" means: you divide 360 by 8 and you get your 45 frames.

Re: having an enemy rotate toward the payer

PostPosted: Sun Oct 26, 2008 6:16 pm
by J Maker
Hey thanks man it works great!