我现在使用starling 框架来做一个flash 游戏。但是我对游戏中的架构很陌生,我认为我在游戏中所做的并不是很好。
我有一个 Screen 类,用于将内容显示到舞台。
public class Screen {
private var button : Button
private var controller : Controller
public function Screen(){
controller = new Controller(button)
}
}
public class Button{
private var controller : Controller
private var button: Button
public function Button(){
button.addEventListener(Event.TRIGGERED, onTrigger)
}
private function onTrigger(e:Event){
controller.notify(buttonTriggered);
}
}
//in the controller class, I have a list of controller which controls other components
//those are added to Screen class (character, ...)
public class Controller{
public function Controller(button){
}
public function notify(event){
switch(event){
//notify to other controller with this event
}
}
}
你对这个架构有什么建议吗?非常感谢您的所有反馈。