having an enemy rotate toward the payer

Game Editor comments and discussion.

having an enemy rotate toward the payer

Postby J Maker » Sun Oct 26, 2008 2:20 am

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.
Some people believe Chuck Norris evolved from a dinosaur, the Chucknorisaurus.
----------------------------------------------------------------------------------
Chuck Norris doesn't sleep, he waits.
----------------------------------------------------------------------------------
Chuck Norris doesn't hunt, he kills.
----------------------------------------------------------------------------------
Chuck Norris once shot down a german fighter plane with his finger by yelling BANG!!!
----------------------------------------------------------------------------------
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score

Re: having an enemy rotate toward the payer

Postby Kalladdolf » Sun Oct 26, 2008 11:30 am

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.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: having an enemy rotate toward the payer

Postby J Maker » Sun Oct 26, 2008 6:16 pm

Hey thanks man it works great!
User avatar
J Maker
 
Posts: 177
Joined: Fri Jun 22, 2007 4:17 pm
Location: in the stick version of Hyrule
Score: 10 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron