Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Actionscript 3.0 to make games and I fall into the category of programmers who use ball.x+=5; ball.y+=5; in order to move a ball by 5 pixels horizontally and vertically.

Well, now i seem to have an issue with a game I am making, it has a 3-body vehicle and each has its own translation and rotation. The three bodies: front, back1,back2 exist inside the top movieclip called vehicle. So each of them has a different coordinate system compared to the top movieclip. Well, when the vehicle crashes onto an obstacle in my game, I have to reset the movieclip, this is done by taking apart all the x,y,rotation of each movieclip into an array at the beginning of the game and restoring it to the beginning position after crash.

Well , but ,now I have stumbled upon this


feature in flash, which allows me to perform mathematical transformations on the movieclip's transformation matrix, and now on applying mathematical transformations on the top level movieclip, all the inside movieclips are affected, It is a huge advantage to me.

But, I would like to know, IF i use this technique by breaking apart my whole code written as of now and re-writing it into using transformation matrices for every single horizontal, vertical or rotation of the vehicle. Will it affect my performance?

Thank you.

share|improve this question
That is some bad design. If you run into something with enough velocity, you will teleport backwards when you crash into something. – AttackingHobo May 13 '11 at 17:25

Using matrices for transformation isn't exclusive to using x, y and rotation properties. These actually all map to the same thing. If you update x, y or rotation, the matrix will also change.

So you can freely mix these things. You can store the initial position matrix somewhere, to easily restore it later on, but you can also still do things like ball.x += 5

There's no negative impact in using the matrix for transforms. I guess it's probably even faster, since you set all transformations at once instead of setting each property individually.

share|improve this answer
+1 for telling me , manipulating matrices is faster, let me wait for some more days while i (code&re-code) :) before I mark this as the answer – Vishnu May 13 '11 at 11:42
You don't have to re-code everything. Like I said, you can freely mix these things. The marginal performance gain of using matrices isn't worth re-coding everything. – bummzack May 13 '11 at 12:15
ok ! Thanks for that too, (this app doesnt let me write just "ok !" :) – Vishnu May 16 '11 at 9:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.