开发者

Best practices for handling math calculations in a flash project?

开发者 https://www.devze.com 2022-12-24 19:49 出处:网络
I\'m building a Flash project where it needs to handle some math, like an acceleration formula. My director has recommended a design patt开发者_如何学Cern where I include the calculations directly in

I'm building a Flash project where it needs to handle some math, like an acceleration formula. My director has recommended a design patt开发者_如何学Cern where I include the calculations directly in the flash object, but that doesn't seem like it's very good OOP.

What's the best practice for calculations in Flash? Should it be a separate object, so I can keep the "non-Flash" parts together and out of the way? What are people's experiences with including it inline vs. keeping it separate?


On the contrary.

A flash object which accelerates should have its motion equations implemented in flash. It should have a class handling it, encapsulating the math. This way, it isn't stuck there, it is just in the right place.

If you take the math out of flash, you'll have to update the objects' positions by yourself, thus loosing a lot of flash's abilities.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号