Board game path
by baylor wetzel · in Torque Game Builder · 04/02/2007 (10:38 pm) · 5 replies
I'm wondering how to move pieces in a board game
For a game like chess, i can use a tile layer. They click tile 2,3, i move straight there with moveTo (well, chess has specific ways to move, but i'm going to ignore that for now because i'm not building one of those kinds of games :) )
For a game like Chutes & Ladders, where you move horizontally across rows, i could have an array track the square numbers and tell me when to move up a line. For the chutes and ladders, i don't know, maybe a trigger?
In Mario Party, you have to make a choice at the fork in the road. i'm not sure how to handle that but it's probably just a simple path finding problem
What interests me is Candyland. It has a long windy path. You draw a card that says "red" and you move to the next red square. i considered mounting my pieces to a path and using the path move command but i'm not sure where to move to. i can't say "path.moveTo(the next red square)". So i'm not sure how to track that sort of information. If the user clicks on the square to move, would it be best to lay scene objects on top of each path node and catch the onMouseDown? If they don't click and i just move automatically, maybe i'd build in script an array that tracked that sort of info and try to keep it in synch with the path nodes. Or maybe i'd subclass the path object. i've done that with the scenegraph and tilelayer but i'm not sure how i'd do it with the path nodes (it might be easy, i'll have to go back and look at the API). i like the latter because i hate having to manually keep different objects/collections in synch
This question probably is more a generic question than a TGB one, and if i have to do it the traditional way with a custom linked list, that's fine, i'm just wondering if there's anything in the TGB path object that might make this job a little easier for me
i'm asking all this because a simple Candyland-like board game seems like it should be easy and my girls has a lot of fun this weekend playing the GameBoy version. Anyone here done a board game that would like to share their secrets?
For a game like chess, i can use a tile layer. They click tile 2,3, i move straight there with moveTo (well, chess has specific ways to move, but i'm going to ignore that for now because i'm not building one of those kinds of games :) )
For a game like Chutes & Ladders, where you move horizontally across rows, i could have an array track the square numbers and tell me when to move up a line. For the chutes and ladders, i don't know, maybe a trigger?
In Mario Party, you have to make a choice at the fork in the road. i'm not sure how to handle that but it's probably just a simple path finding problem
What interests me is Candyland. It has a long windy path. You draw a card that says "red" and you move to the next red square. i considered mounting my pieces to a path and using the path move command but i'm not sure where to move to. i can't say "path.moveTo(the next red square)". So i'm not sure how to track that sort of information. If the user clicks on the square to move, would it be best to lay scene objects on top of each path node and catch the onMouseDown? If they don't click and i just move automatically, maybe i'd build in script an array that tracked that sort of info and try to keep it in synch with the path nodes. Or maybe i'd subclass the path object. i've done that with the scenegraph and tilelayer but i'm not sure how i'd do it with the path nodes (it might be easy, i'll have to go back and look at the API). i like the latter because i hate having to manually keep different objects/collections in synch
This question probably is more a generic question than a TGB one, and if i have to do it the traditional way with a custom linked list, that's fine, i'm just wondering if there's anything in the TGB path object that might make this job a little easier for me
i'm asking all this because a simple Candyland-like board game seems like it should be easy and my girls has a lot of fun this weekend playing the GameBoy version. Anyone here done a board game that would like to share their secrets?
About the author
#2
04/30/2007 (1:15 pm)
I'm no expert in TGB and I admit I haven't even touched this aspect of it, but TGB does have paths that you can create in advance and I'm guessing you can attach any object to any path in real-time with the proper scripting.
#3
04/30/2007 (4:21 pm)
Deozaan, you can attach objects to paths through scripting, you can also create paths in script -- I believe his actual question was related to movement along the path, moving from node to node ...
#4
04/30/2007 (4:39 pm)
I would just add custom data to the tile layer for whether it's a shoot or ladder and what tile location to move to, for example. But maybe that's too easy? :)
#5
04/30/2007 (7:02 pm)
..............
Associate David Higgins
DPHCoders.com