Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / move towards player

Author
Message
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 26th Jun 2008 14:39 Edited at: 26th Jun 2008 14:43
Ok, I got an enemy(ID : 100), and the player (ID : 1)

I made the enemy spawn in a random location, now to the problem : How do I make the enemy move towards the player? No matter where the player might be.

If I'm not totally mistaken, I have to put the movement command in the main loop to make the enemy move at all times?

My code so far :



If you find any other errors or bad structure, point that out to if you wish.

- Elias, Damezean, Nackidno, Wonderboy

AntocGames - http://antocgames.se.nu/
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 26th Jun 2008 18:42
Yes, in the main loop put something like this:



Los Mineros are back in progress!
nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 26th Jun 2008 18:47
Thanks. I thinked about that right after I wrote my post. I did never test it though. Thanks, will see if it helps.

- Elias, Damezean, Nackidno, Wonderboy

AntocGames - http://antocgames.se.nu/
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Jun 2008 00:50
If you don't want the enemy to fly into the air if the player jumps, try:



nackidno
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Där solen aldrig skiner
Posted: 27th Jun 2008 22:59
Thanks for that, though I have no need for it in my project since the player stand still all the time. Thanks anyway, it might get usefull in later projects.

- Elias, Damezean, Nackidno, Wonderboy

AntocGames - http://antocgames.se.nu/
Farooqaaa
18
Years of Service
User Offline
Joined: 26th Jun 2006
Location: Universe
Posted: 2nd Jul 2008 19:43
Thanks a lot maczero. That code is working much better. And thanks Sixty squares for fixing the jump bug.

Login to post a reply

Server time is: 2024-09-27 16:34:51
Your offset time is: 2024-09-27 16:34:51