actor patrolling. I'm missing something simple, please help :)

pjnolenpjnolen Member Posts: 152
edited November -1 in Working with GS (Mac)
Let me explain first what I'm trying to do and then explain what I've done so far.

I have 12 actors(4 actors but 3 types of each).
I have 5 patterns of movement that 1 of each type of actor(so 4 at a time on the screen) will do. Each round i'll have those 4 actors do 1 of those 5 patterns of movement.

What is the easiest way to set up the patterns so that each round I can specify a pattern and have the appropriate actor follow his appropriate path route?

I need any of the 4 types to follow a corresponding path in a pattern.

I though that it would be best to make 4 more actors and call them waypoints(1,2,3,4) and program in the patterns under them and constain the 12(3 of each to 1 corresponding waypoint) badguys to them as a faster way than putting all 4 routes of all 5 patterns in all 12 actors resulting in 240 behaviors and rulls for them instead this should only be 4 routes in 5 patterns in 4 actors.

The problem I have is generating a path. I know how to move an actor from A to B. But A to B to C to D to E to F and then when finished repeat, until destroyed. I can't use timers for each redirection in the path as that would lead to probably thousands of timers if you multiply it out.

So to sum up, i want to move one actor in a pattern on the screen, then back to their starting point, and repeat.

Advice?

Comments

  • svnsvn Member Posts: 445
    Create rule: when self.position.X/Y is greater/less than or equal to waypoint.position.X/Y,
    MOVE TO original waypoint.position.X/Y
  • pjnolenpjnolen Member Posts: 152
    But how do I move to multiple points before I return to the original location?
  • JeffreyShimaneJeffreyShimane Member Posts: 372
    In the way you have it set up, you could have it so that when the bad guy actor overlaps/collides with the waypoint actor, an attribute is changed. Then you could have a check for the value of the attribute and based on that, have it head to the next waypoint.

    - Jeff
  • pjnolenpjnolen Member Posts: 152
    the way i have it, the waypoint(bad choice of words really)has the actor constrained to it, and is moving along the patrol path.

    If I had a patrol path. That's the problem, I don't know how to tell Gamesalad to move an actor to a location, then to another location, and keep going to various locations on the screen.

    How do you do that without a timer?
  • JeffreyShimaneJeffreyShimane Member Posts: 372
    Sorry, I missed that part where you said you had the actor constrained to the way point.

    You could try something like this:

    Create 4 rules (this is just an example for a 4 way point setup where the actor moves in a square pattern).

    Rule #1:
    If self.position.X is 0 and self.position.Y is 0, interpolate self.position.X to 100.

    Rule #2:
    If self.position.X is 100 and self.position.Y is 0, interpolate self.position.y to 100.

    Rule #3:
    If self.position.X is 100 and self.position.Y is 100, interpolate self.position.x to 0.

    Rule #4:
    If self.position.X is 0 and self.position.Y is 100, interpolate self.position.Y to 0.

    Change the interpolation durations to suit your needs.

    - Jeff
  • pjnolenpjnolen Member Posts: 152
    wow, i knew it was simple, i COMPLETELY forgot about using x and y loc as conditions for a rule...my brain is so fried...

    Thanks Jeff, you got me going again!
Sign In or Register to comment.