How to handle on every ENTER_FRAME model or view updates in Robotlegs so that it was not expansive?

naghekyan's Avatar

naghekyan

08 Jan, 2014 07:48 AM

Say I have a ball that bounces from the walls - something similar to the Arkanoid game. In this case you should listen to ENTER_FRAME event and change the coordinate of the ball depending on velocity, previous coordinate, whether if it bounced from the wall, etc. All this is being done in model. Should I dispatch an event on every ENTER_FRAME which contains new coordinates of the ball calculated in the model to the view so that the view is updated?

In general, if on every ENTER_FRAME I have to update model via view or vice versa, should dispatch and event, create a command which will inject a model and change the model's data on every ENTER_FRAME? Isn't it very expansive and slow? Is there a better approach here?

P.S. Please consider that I might use for example Box2D in my model to calculate ball coordinates.

  1. Support Staff 1 Posted by Ondina D.F. on 08 Jan, 2014 09:58 AM

    Ondina D.F.'s Avatar
  2. 2 Posted by naghekyan on 08 Jan, 2014 12:19 PM

    naghekyan's Avatar

    So pity that the license info is much longer than the "what is it about" info :( Though I have looked the demo code with Bunnies I could not understand the main idea behind the Ember and the approach in this problem. :( Maybe I will find time to investigate code thoroughly later.

    Thanks for pointing out the direction!

  3. Support Staff 3 Posted by Ondina D.F. on 09 Jan, 2014 10:16 AM

    Ondina D.F.'s Avatar

    You're welcome!
    Yes, I know, it's not easy to understand the concepts without documentation, and I can't help you either, sorry.

  4. Support Staff 4 Posted by Shaun Smith on 09 Jan, 2014 02:02 PM

    Shaun Smith's Avatar

    Hi. I tried out Ash a while ago. You can read about my experiences here: http://shaun.boyblack.co.za/blog/2012/08/04/games-and-entity-systems/

  5. 5 Posted by naghekyan on 13 Jan, 2014 02:55 PM

    naghekyan's Avatar

    Thank you so much! This is a great article. I have learned a lot of very important and nice things from your article. Nice to have such people sharing knowledge.

  6. Support Staff 6 Posted by Shaun Smith on 13 Jan, 2014 03:20 PM

    Shaun Smith's Avatar

    It's a pleasure :) I'm going to close this discussion for now - feel free to open a new discussion for further questions.

  7. Shaun Smith closed this discussion on 13 Jan, 2014 03:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac