Page 1 of 3

Bug/help in move to action

PostPosted: Sat Oct 20, 2007 12:34 pm
by Freddy
I think there is a bug in the draw actor -> move_to function. When you use another event such as keydown, the move to works fine, but with draw actor, the actor that needs to move stays still, at least when there are obsticales. Is there a way that I can have an actor move to another actor, and dodge obsticales? Here is a screenshot to help explain. The red dot represents a zombie. The blue dot represents you. I want the red dot to move towards the blue dot, while avoiding the buildings. And of course the player would be moving around too, so it would be nice if the zombie could keep renewing the targeted location. Please reply if there is a way to do this, it is crucial to my new game. :)

Re: Bug/help in move to action

PostPosted: Sun Oct 21, 2007 6:55 am
by Fuzzy
There are two move-to functions. one is for draw, and the other is to move actors. You want to use MoveTo and not moveto

Re: Bug/help in move to action

PostPosted: Sun Oct 21, 2007 3:11 pm
by Freddy
Yes, I did that, but if you put obsticales in the way, it wont move at all. :(

Re: Bug/help in move to action

PostPosted: Mon Oct 22, 2007 3:15 am
by Fuzzy
Oh I see. you are looking for path-finding. Google A* and or pathfinding. its been done to death. Lots of information out there

Re: Bug/help in move to action

PostPosted: Mon Oct 22, 2007 8:14 am
by DilloDude
Does the avoid with MoveTo work properly when used with another event?

Re: Bug/help in move to action

PostPosted: Mon Oct 22, 2007 1:26 pm
by makslane
The avoid option of the Move To action uses the A* algorithm.
The action calculates the path only when is called. If you want to update the path, you can call the Move To action in a Draw Actor event.

Re: Bug/help in move to action

PostPosted: Tue Oct 23, 2007 11:34 pm
by Freddy
I already made the draw actor MoveTo event, but when I made it avoid an obsticale, it would not move. I have a question about the A* for Fuzzy though: How on earth am I supposed to apply the concept to GE? I also dont get a word of it, but I only made one search, so I will keep trying :D .

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 9:21 am
by Kalladdolf
I got another question.
can u also make an actor avoid others without moving to something?
for example: I got a spaceship an asteroids are flying towards it and it has to avoid them automatically.
how?

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 1:26 pm
by Bee-Ant
Ship>DrawActor>ScriptEditor>
Code: Select all
if(y==asteroid.y+25) //if the asteroids are moving down
{
    avoid=rand(10);
    if(avoid<5)
    {
         x=x+5;
    }
    if(avoid>5)
    {
         x=x-5;
    }
}

maybe it could works...

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 1:36 pm
by Kalladdolf
There's actually a function called "avoid"?
Why didn't I see it???
and in your code it seems like avoid is horizontal... :?

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 1:51 pm
by Bee-Ant
No, it's an actor variable...
Uh huh... :D

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 1:54 pm
by Kalladdolf
AH, I get what u mean!
that's too easy!
why didn't I think of that?
*sniff*
buhuuuuuuuuuuu!
do you know where ma brains is?

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 1:59 pm
by Bee-Ant
In your knee :P nonono...don't hear me

Re: Bug/help in move to action

PostPosted: Wed Oct 24, 2007 5:21 pm
by Kalladdolf
I ate it for breakfast :D
Now, I'm tired.
G'night!

Re: Bug/help in move to action

PostPosted: Thu Oct 25, 2007 1:48 pm
by Bee-Ant
I realy fun could online together with you Kall... :D
But you can't stay here longer... :(