Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
move towards point #282107
07/30/09 12:07
07/30/09 12:07
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
I tried 100 ways to make the enemies follow the player, but noone works. I tried with the c_move command.
so, if it is simple can you copy the code here, if not can you give me link to an example?
Thx.

Last edited by mEnTaL; 07/30/09 12:07.
Re: move towards point [Re: mEnTaL] #282143
07/30/09 14:13
07/30/09 14:13
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Is there object avoidance involved?
If not, it's simple. If there are objects in the way, this can get anywhere from complex to incredibly-hard.


~"I never let school interfere with my education"~
-Mark Twain
Re: move towards point [Re: Germanunkol] #282146
07/30/09 14:30
07/30/09 14:30
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
No, there are no objects staying in the way.

Re: move towards point [Re: Germanunkol] #282147
07/30/09 14:31
07/30/09 14:31
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Without obstacles:
Turn_to_player();
Move();

With obstacle:
Turn_to_player();
Check_left_if_obstacle_then_turn_right();
Check_right_if_obstacle_then_turn_left();
Move();

Something like this smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: move towards point [Re: VeT] #282175
07/30/09 16:19
07/30/09 16:19
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
In the language of lite-C how will be this ? wink

Re: move towards point [Re: mEnTaL] #282540
08/01/09 22:39
08/01/09 22:39
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
Can you give me only the code which keeps the entity always rotated towards player pls

-Thx-

Re: move towards point [Re: mEnTaL] #282545
08/01/09 23:29
08/01/09 23:29
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth

action RotateTowardsPlayer()
{
VECTOR myTemp;
while(1)
{
vec_diff(myTemp,player.x,my.x);
vec_to_angle(my.pan,myTemp);

wait(1);
}
}

This should works.


~"I never let school interfere with my education"~
-Mark Twain
Re: move towards point [Re: Germanunkol] #282632
08/02/09 17:45
08/02/09 17:45
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
It works fine, Thanks.

Re: move towards point [Re: mEnTaL] #283662
08/09/09 07:23
08/09/09 07:23
Joined: Jul 2008
Posts: 223
Pittsburgh
The_Clyde Offline
Member
The_Clyde  Offline
Member

Joined: Jul 2008
Posts: 223
Pittsburgh
If you want a smoother and more natural method of following try this:

action TurnTowardsPlayer()
{
VECTOR difference;
VECTOR angle_to_player;
VECTOR ang_diff;
VECTOR steering;
while(1)
{
vec_diff(difference,player.x,my.x);
vec_to_angle(angle_to_player,difference);
vec_diff(ang_diff,angle_to_player,my.x);
vec_set(steering,ang_diff);
steering[0] = ang(steering[0]);
steering[1] = ang(steering[1]);
steering[2] = ang(steering[2]);

vec_normalize(steering,time_frame * 10);

if(vec_length(ang_diff) > 1) vec_add(my.pan,steering);

wait(1);
}
}

Is it alright that I built on top of yours, Germanunkol? laugh

What this does is steer towards the player entity instead of just snapping right to the direction of the player.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1