Make an actor go through maze?

blue_elephantblue_elephant Member Posts: 505
edited April 2013 in Working with GS (Mac)
Is there a way to make an actor automatically go through a simple maze (like zigs zags or so) even if it requires the actor to go the opposite way from the finish?
Thanks

Kinda like this game: http://www.mindjolt.com/warzone-tower-defense.html

★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    You could use a table to define each square's possible directions that it can go to.
  • blue_elephantblue_elephant Member Posts: 505
    @CodeMonkey Not sure I understand. How would you go about this?

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • ElfizmElfizm Member Posts: 489
    Have a table with two columns. One for x values, the other for Y.
    YOU then type in the positions of where it needs to go,

    Eg, 10,29
    10,44
    13,44

    You will then use the interpolate or move to behavior to go to those positions. It involves a bit more, but i am pretty sure that's what codemonkey was referring to.
  • blue_elephantblue_elephant Member Posts: 505
    The maze will be different as the player builds it. how do I change the values?

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • ElfizmElfizm Member Posts: 489
    Is it a grid maze, where they place down actors, or are They already on the screen imvisable?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    actually I was thinking, if your maze was on an 8x8 grid, you set up your table with 8 rows and 8 columns. Each cell has a text representing which directions an actor in that square has an exit.

    Blank - No exit
    N - North
    S - South
    E - East
    W - West
    NW - North and West
    NS - North and South... etc.

    Then when an actor gets to a cell, it pulls the data from the table and checks if it contains a direction to go to.
  • blue_elephantblue_elephant Member Posts: 505
    @Elfizm It is a grid maze like you said

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • blue_elephantblue_elephant Member Posts: 505

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • ElfizmElfizm Member Posts: 489
    It's not taking me to any game. Just a list of games and none are tower defence.?

    So just to be clear?

    It's a grid game
    The player is creating the maze
    How are they doing this? By touching each sqaure?

    If so it's going to be quite complicated to work with. Very. If you can provide an image of an example it should help a lot.
  • blue_elephantblue_elephant Member Posts: 505
    Here's an example picture:
    http://thumbs1.mochiads.com/c/g/warzone-tower-defense-extended/screen2.jpg

    The player clicks on a gun they want and place it on the grid. enemies come in and try to make their way to the base. The guns automatically shoot toward the enemies. Once the base loses it's health the game is over.
    Thank you for your help!

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2013
    Is there a way to make an actor automatically go through a simple maze (like zigs zags or so) even if it requires the actor to go the opposite way from the finish?
    In most tower-defense games, the maze is predefined and the enemies just follow a set path (or perhaps one of several set paths). That's not terribly hard to program but what you're suggesting, where the enemies figure out the best path through a player-generated maze is going to be very difficult to do. I think you'll need to do research into path-finding algorithms.

    This template might be useful: http://marketplace.gamesalad.com/#category=13&product=12730

    It seems like if you had the player place possible waypoints/intersections you might have better luck getting the enemies to figure out the maze, but that's expecting a lot from a player.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ElfizmElfizm Member Posts: 489
    Sorry for the late reply, but I see @tatiang has answered.
    Most tower defense games have a set path. Feildrunners 2 has a grid method in which the troops take the quickest path.

    This too is very complicated, don't expect any one to give it away free.

    I was playing around with and it's come to a lot of variables. Going to attempt it tonight if have time. But as stated before, having a pre calculated course would be done easier. Then have the option to place guns on the sides of the path.

    Then you would use tables as mentioned to before.
  • blue_elephantblue_elephant Member Posts: 505
    Thank you all for your suggestions. I will consider using the predetermined path like you said

    ★ My Apps | Gamesalad Tutorials : Youtube Channel , Website. ★

Sign In or Register to comment.