Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Please help #306160
01/20/10 08:02
01/20/10 08:02
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
Can any one please give me some code for enemy A.I. that makes the enemy walk straight to the player. I am doing versus game and I need a starting code to program the A.I. I'm really lost at what to do right now.

Here is my enemy action code

============================================================

action player_cb()
{

//ENEMY IS STANDING ON GROUND
VECTOR vFeet;
vec_for_min(vFeet,me);
set(my,FLAG2);
my.ESTATE = 1;
//ENEMY IS IDLE
if(my.ESTATE == 1)
{
my.EANIMATION += 10 * time_step;
ent_animate(my, "idle", my.EANIMATION, ANM_CYCLE);
var dist_between = pos_player - pos_cb;
if(dist_between != 0)
{
my.EANIMATION = 0;
my.ESTATE = 2;
}
else if(dist_vs == 0)
{
my.EANIMATION = 0;
my.ESTATE = 1;
}
}


if(my.ESTATE == 2)
{
var distance = (dist_vs)*5*time_step;
c_move(my, vector(0,distance,0), NULL, NULL);

walk_percentage -= 3*distance;
ent_animate(my,"walk",walk_percentage,ANM_CYCLE);
my.EANIMATION = 0;
my.ESTATE = 3;
}
if(my.ESTATE == 3)
{
my.EANIMATION = 0;
my.ESTATE = 1;
}

============================================================
got so many error there. I cant run it.


If you do not know where you are . . .
Ask a villager.
Re: Please help [Re: DirtyDhan] #306192
01/20/10 12:25
01/20/10 12:25
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
again, like i asked you before, make ONE topic for your problems...
use topic names that make sense, please help does not indicate what the problem is, and is generally not really well accepted in the community..

thanks!


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/

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