- Home /
Question by
Hedge · Apr 19, 2015 at 03:31 PM ·
objectscommunication
Two-way communication between parent and children-objects
I've got a Gameboard containing a lot of dices.
Every can be tilted to either direction (limited by the boundaries of the Gameboard and other dices in their way) by dragging the mouse on top of it in on of the four directions. So the dices themself handle the input but before executing a tilt I have to check whether the move is allowed on the gameboard.
Therefore I'd give every dice a reference to the gameboard but is there a better way to get this two-way behaviour?
Comment
Answer by Berge · Apr 20, 2015 at 06:35 AM
I would do it the same way. I'd make a public bool method on the gameboard that returns true/false depending on if the move is allowed or not.