Jump to content
  • Advertisement
Sign in to follow this  
AmirOssanloo

How to manage controls?

This topic is 2114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I am creating this game in AS3 (I know) in MVC and I bumped into a bit problems with understanding how to structure my entities.

 

So I have my EntityModel, EntityView and EntityController that will be the parent classes for all my entities. Then I have my Enemies and lets call them Allies classes that extend the Entity classes.

 

My EntityModel class is currently quite empty. I assume that this is where I will have functions such as attack(), move() and such.

My EntityView displays the graphics and I have added event listeners here that checks if the mouse button is clicked or not.

_stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);

private function onMouseDownHandler(e:MouseEvent):void
{
_controller.processMouseDown(e);
}

In my EntityController class I have prepared to process the mouse down button. But this is where things get confusing for me because when I try in EnemyGruntController extend EntityController to override this processMouseDown. I get an error "Method marked override must override another method. override internal function processKeyDown(e:KeyboardEvent):void"". It seems like I can't override this function, but I want to give different units different commands on MouseDown.

internal function processMouseDown(e:MouseEvent):void
{
// Process mouse down commands.
}

I've spent a few days googling on MVC and what class should do what, but it is very hard to comprehend in the beginning. So is there anyone that have a good example of a simple game or class structure that resembles this:

 

[attachment=18268:structure.jpg]

 

Thanks and sorry for the vauge post.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!