Original Post
I was reading about an MVC architecture from this article: http://www.gamasutra...code.php?page=2
There are a few things I'm unclear about. Lets use a simple pong game as an example. We have two entities (models) paddle and ball. A paddle has a controller which can get input from a keyboard, mouse, or whatever else. Based on the input the controller decides what the paddle should do. So for example, if I press the up arrow on my keyboard the controller will receive that and will set a direction variable to up. The model will then poll its controller for the direction and move accordingly. My question is how exactly is the paddle's controller supposed to handle collision with the ball or the other way around. How are the models or controllers supposed to interact with other models. Is the controller even supposed to know about its specific model? It doesn't seem like this is the case according from this diagram (from the article):
[media]http://www.gamasutra.com/features/20050414/rouwe_00_clip_image002.jpg[/media]
There are a few things I'm unclear about. Lets use a simple pong game as an example. We have two entities (models) paddle and ball. A paddle has a controller which can get input from a keyboard, mouse, or whatever else. Based on the input the controller decides what the paddle should do. So for example, if I press the up arrow on my keyboard the controller will receive that and will set a direction variable to up. The model will then poll its controller for the direction and move accordingly. My question is how exactly is the paddle's controller supposed to handle collision with the ball or the other way around. How are the models or controllers supposed to interact with other models. Is the controller even supposed to know about its specific model? It doesn't seem like this is the case according from this diagram (from the article):
[media]http://www.gamasutra.com/features/20050414/rouwe_00_clip_image002.jpg[/media]