Hie guys i am working on a mancala game.I designed everything and some but what i am failing to figure out is how to make a logic node that when the user clicked it triggered the clicked pit(where many balls or seeds will be) to distribute the balls/seeds in the following pits one ball/seed in each pit then come to a stop when there are no more balls /seeds to distribute or sow. when playing this game in real life a player picks up all the seeds in one pit and “sows” them to the right, placing one seed in each of the pits along the way Really need help how to do this.
Online mancala games
additional info on how to play the mancala game in real life
this is the kind of mechanics i want to achieve.The mancala i am creating is different but the mechanics are the same
.A Sample video of how mancala works
I would like to approach the game design step by step. So, as for your main question,
make a logic node that when the user clicked it triggered the clicked pit
I suggest using physics sphere for this. 1. place an appropriately sized sphere in each pit with not too many vertices.
2. to all the spheres, add a rigidbody physics, type sphere, passive and not animated. In the render panel, disable visibility of all the spheres. But they must be exported and spawned in the scene
3. Make a logic tree such as
on mouse click>> cast physics ray >> object.
4. That gives you the sphere selected with which the put can be determined.
5. Apply this logic tree to the scene/ mankala board.
Note: Due to lack of time, I have not had a look at your .blend file.
Pick Object node instead of
cast physics ray node
1 , will try to use spheres ,though i have used empty spheres for this .Still it will solve the issue of
the clicked pit
Once clicked , i want the balls /seeds contained in the clicked pit to distribute to the next or following pits each ball per pit
So what i want is to spawn balls from the selected sphere into the next pit or spheres evenly, one per pit.
In the screenshot Each pit has 2 balls .That’s how the game starts.A pit numbered (1) marked with blue square is clicked for instance. 2 balls contained in that pit moved to the next pit (one ball in number 2 making the total 3 and another ball in number 3 as well) This leaves number 1 with no ball since they have been put or sowed into the next pits.The last ball falls in number 3. If number 3 is clicked the same concept happens again spawning the 3 balls into number 4 ,5 and 6 ,leaving number 3 empty .Number 6 will do the same since the last ball ends there.Number 6 will spawn into number 7 ,8 and 9.This will continue until a stop where the ball ends up in an empty pit.
The issue is even if use spheres, with rigidbody physics and get them selected ,How to make the balls in selected sphere spawn to the next spheres evenly or one ball at a time per pit (meaning one ball goes into one pit /sphere and so on) ?
How to make the balls in selected sphere spawn to the next spheres evenly or one ball at a time per pit
For this I propose using an empty as a spawning point. Since the distance between the centers of the pits are same in any one direction, you can get a fair idea where to place the balls.
- Translate the Empty to the pit selected, at the center of the pit, at some height.
- a. Make the pieces/balls invisible or b. Remove them from scene if you wish.
- Move the empty to the next pit by a pre-known distance to the next pit center on one axis
- a. Translate the objects to the location of the empty and make them visible or b. Spawn a piece/ball at the location of the empty
- Repeat this step by moving the empty to the next pit and spawning a piece/ball
I see that’s an interesting approach to this one .Let me work on it this way and see how it will work out.Thanks a lot