My questioin is pretty much in the title, Why do I keep reading in actionscript 3.0 that its a good idea to seperate the 'mind' from the 'object' when writing code?
Thanks for any help, this is confusing the hell out of me.
My questioin is pretty much in the title, Why do I keep reading in actionscript 3.0 that its a good idea to seperate the 'mind' from the 'object' when writing code?
Thanks for any help, this is confusing the hell out of me.
If you're asking why graphics are separated from the positioning, movement and physics; take this tree I've drawn:
In the tree you'll see that Entity
has two properties:
Moving down, you will see that there are several things that extend Entity
- most notable are the Player
and the Enemy
classes.
Extending my Entity
class above, I can easily change what should be used as the graphics
and also provide slightly different bodies
. For example, the player and enemies will have obviously different appearances, and the Tree
class won't need to use a Body
that deals with values like velocity because it doesn't move.
Here are some advantages of the above:
MovieClip
if you had extended MovieClip
with your Entity
class.Graphics
class such as being able to easily covert a Sprite or MovieClip into a sprite sheet for better performance.Body
can be updated without immediate effects on the graphics.