Page 1 of 1

following the target

PostPosted: Sun Feb 22, 2004 9:39 pm
by hobgoblin
on my game, the bad guys have to follow the target and smack him
(i tried the tutorial but i didnt understand...)

i tried...
(in the badguy)

draw actor
add action
conditional action

conditional action
expression 1:
y
expression2:
target.y

then i should go to script and type "y=y+5"

what am i doing wrong

PostPosted: Sun Feb 22, 2004 9:42 pm
by hobgoblin
and by the way!

i'm gonna put a "bad guy factory" to produce more badguys!

but the factory produces only one and stop!

how can i make it produce more?

PostPosted: Mon Feb 23, 2004 5:36 pm
by makslane
Try this:

On Draw Actor, add a Script Editor action:

if(target.y > y) y = y + 5;
else if(target.y < y) y = y - 5;

if(target.x > x) x = x + 5;
else if(target.x < x) x = x - 5;


Factory:

On Create Actor event:

1) Add a "Create Timer" action
2) choose new timer

Name: any name
Time: 12
Type: Periodic
Repeat: Specify quantity
Count: 100 (to create 100 bad guys)

3) Ok, Add, Immediate Action


On Timer event:

1) choose your timer
2) Add "Create Actor" action

Actor: bad guy
Animation: (set if any)
Parent: no parent
Path: no path
Initial Position: 0, 0
Relative to creator: yes

3) Add, Immediate Action


To put your bad guys on a random location:

On Bad Guy Create Actor event:

x = rand(view.width) + view.x;
y = rand(view.height) + view.y;

PostPosted: Tue Feb 24, 2004 1:17 am
by hobgoblin
makslane wrote:Try this:

On Draw Actor, add a Script Editor action:

if(target.y > y) y = y + 5;
else if(target.y < y) y = y - 5;

if(target.x > x) x = x + 5;
else if(target.x < x) x = x - 5;




doesn't work

are you sure i don't have to declare the goodguy as the target for the badguy before i white this thing?
(i don't know how to do it =P )

PostPosted: Tue Feb 24, 2004 1:55 am
by hobgoblin
To put your bad guys on a random location:

On Bad Guy Create Actor event:

x = rand(view.width) + view.x;
y = rand(view.height) + view.y;


ok, but i don't want then to be created on random
i want to create them out of the screem and make them walk slowly to the character

PostPosted: Tue Feb 24, 2004 4:53 pm
by makslane
hobgoblin wrote:
doesn't work

are you sure i don't have to declare the goodguy as the target for the badguy before i white this thing?
(i don't know how to do it =P )



This works?

if(goodguy.y > y) y = y + 5;
else if(goodguy.y < y) y = y - 5;

if(goodguy.x > x) x = x + 5;
else if(goodguy.x < x) x = x - 5;

PostPosted: Tue Feb 24, 2004 8:05 pm
by hobgoblin
makslane wrote:
hobgoblin wrote:
doesn't work

are you sure i don't have to declare the goodguy as the target for the badguy before i white this thing?
(i don't know how to do it =P )



This works?

if(goodguy.y > y) y = y + 5;
else if(goodguy.y < y) y = y - 5;

if(goodguy.x > x) x = x + 5;
else if(goodguy.x < x) x = x - 5;


that is better...ty!