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.

DarkBASIC Professional Discussion / Character Trailing

Author
Message
Patrick767
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 9th May 2011 17:20
I can't figure out how to make multiple objects follow the player. My idea is like a football type game, but I can't get the "defense" to chase my player. Can I get some help?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th May 2011 19:23
Is this 2D or 3D?

It makes a bit of a difference to the code.

In 2D you need to set the angle of the player based on the angle between the enemy player and the player with the ball. This can be calculated using "atanfull". Just take the sprite position of the player with the ball from the sprite position of the enemy and feed the difference in x and y into atanfull to get the angle between them.

In 3D you can use "point object" (using "object position x(obj)" (...also using y and z) to point at the player with the ball) and "move object" to move towards him.

Hope that helps!

Patrick767
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 10th May 2011 17:07
It is 3D. This should help. Thanks

Login to post a reply

Server time is: 2026-07-11 02:37:01
Your offset time is: 2026-07-11 02:37:01