Problems with touch and move
mikbio
Member Posts: 54
Hey guys,
I filled my scene with square background actors with some rules to make my main actor move towards them when i touch on one of it.Now i would like my main actor to move on my scene from a square to another but one square at the time, and stop it from going back to a square already touched. Any suggestions...
Thank you very much for your precious help.
Comments
I think the answer to your question is already in the forum, just search for path finding.
You would need to determine which square to move to first. Do you have a specific order in mind or is it random.
From a 30k foot view, I would say that you might want each of the actors ( the back ground actors ) to be broadcasting their X, Y cords for your player to move to.
Here is one way of doing it, not sure if it will fit your needs though. Was just thrown together from your description.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Yes your demo file suits perfectly what i needed, and it's almost the same thing that i was able to achieve in my project. The only thing left now it's, how to get my main actor to move just 1 square at the time, making it able to move only on the squares touching the one with the main actor on it. Any clues?
I wasn't able to find on the forums what i needed, but thanks to the keyword pathfinding i found another thread that helped me solving another problem
@mikbio, in the demo I posted the green square moves exactly one square at a time. I jumps to it's new position when you touch the next white square.
Would you rather see the green square slide to its new location instead of just jump to it?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@jamie_c, your demo is PERFECT, it does everything i wanted. But i would also like to have my main actor moving only on the squares that are next to the one where he stands on. Basically i don't want my main actor to jump over far away squares, but i want it to move only on the adjacent squares.
Excuse me if i didn't explain myself well in the previous posts.
Oh i see.
You might have to set it up in a different way then, I'm not sure off the top of my head but it would be a bit more complex set up I'm sure. If I come up with a solution I'll let you know, but if you have any ideas in the mean time I'd try them out too...
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
My only idea atm is to have a rule that spawns the other squares while the main actor is moving. But i don't think it's a good solution. I'll keep thinking. By the way, thanks alot for you help.
Probably the most elegant solution would use tables to keep track of the actors position and activate/deactivate the the adjoining squares. I'm at work at the moment and probably won't have time to look into in more detail today I'm afraid.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Well i'll try to learn something on tables then . I'm an early GS user, but unfortunately, i haven't use it for a long time...and have absolutely no knowledge about using tables.
Thanks again