PlayMaker Help & Tips > PlayMaker Help

AI - Customers sorting them selves into lines.

(1/2) > >>

vonpixel:
Im working on a game right now and have come pretty far.

The game is 2D and fairly simple.Im using 2d tool kit and itween to draw and animate most of my stuff. The player is attempting to attract customers to their cart to sell food too. Ive got more or less everything "done"- and now Im going back over my customers and adjusting and tweeking them.

Right now- they sort them selves into 1 of 2 empty objects just for orginzational sake. 1 is for wandering customers and the other for purchase customers. The purchase ones I would love to set up to sort of stand in a line... and im a bit at a loss of how to do this. Right now they will just stack on each other.

This screen shot will give you a basic idea of what the game looks like..



The customers travel to the truck and when they make contact with the trigger zone infront, the purchase system takes over. Given the way I have the characters moving (itween move to)- what would be a good way to get these guys to stand in a line and let me effect that line easily (such as cash everyone out at once quickly)?

Im guessing I need to impliment collisons, but Im hoping there is an easier logical way.

This is what I was thinking, and I would love some insight.
1. Customer gets the "pruchase zone" destination v3 and moves towards it and sorted into the customer line.
2. Customer maybe gets assigned a # (a little unsure the best way to do this... an array?) and offsets its destination by customer line # x 10?
3. Dynamically update that customer # until it hits the purchase zone?

I would like the line to be somewhat dynamic though and this seems like a very rigid way to go about doing it.

Id really appreciate any suggestions.

kiriri:
this can be simpler than it looks. If you have already sorted your people into empties, then just use their position in the hierarchy of the empty as your "list".
What I mean is you can create an FSM on your empty which loops through all the children it has (Get Child Num + Int add) and then for each children it could do something like (Vector3 multiply (( 0,1,0.1) * child index (the same you used to get the child) ) + SetPosition (in local space to what your vector3 put out)).
This way you can just move your empty around to change the start of the line (because of the local space)

Then, each time when one customer is served, he is unparented from the empty and the second person in the line will now have "index" 1, which makes everyone move on one place.

I see I made it look overly complex but I hope you get my point :D Otherwise I can just fix you up an example project.

vonpixel:
Ok- that actually makes a lot of sense.

Ill try this out tonight / tomorrow when I get home from my day job and back into my passion job.

What you describe is more or less what I was thinking, but I was unsure the best way to go about doing it. In my head I had something that was much more complicated than that- but would do the same thing more or less. I like what you have suggested. Seems there will be lots of room in there to expand the line dynamics should I want to.

Thanks for clearing up my vague ideas! Cheers!

vonpixel:
Ok- Im trying things out and getting stuck somewhere. When I add a Get Child Count to count the empty, it doesn't update as my customers get added to it. I can make a next frame event, and basically make a loop and int will update then. I feel like if there was an every frame box there, this would make sense. What am I doing wrong here?


Should I intstead maybe have my customer send an event to the customer line fsm to add its self to the list?

kiriri:
I don't think I quite understand... Can't you just use the count action right before you'd use the count variable? In the same state I mean? This could be in the FSM of your customers.

Navigation

[0] Message Index

[#] Next page

Go to full version