Be a Supporter!

converting AS1->AS2 script fails

  • 271 Views
  • 2 Replies
New Topic Respond to this Topic
Ghoul-5
Ghoul-5
  • Member since: Jul. 31, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
converting AS1->AS2 script fails 2008-11-29 07:24:06 Reply

Hey. I'm updating an old project from Flash 6, AS 1.0 to Flash 8, AS 2.0.

When i change it in the publish settings and test it, some things do not work. I managed to fix most of them, but i can't fix this:

onEnterFrame = function () { P1Rotate();P2Rotate();};
function P2Rotate() {
if ((player1._x > player2._x) && (_root.Player2._xscale > 0)) {
_root.Player2._xscale *= -1;
} else if ((player1._x < player2._x) && (_root.Player2._xscale < 0)) {
_root.Player2._xscale *= -1;
}
}
function P1Rotate() {
if ((player2._x > player1._x) && (_root.Player1._xscale > 0)) {
_root.Player1._xscale *= -1;
} else if ((player2._x < player1._x) && (_root.Player1._xscale < 0)) {
_root.Player1._xscale *= -1;
}
}

It works fine in the old project but when i update it doesn't do anything. I guess i may be using outdated syntax or deprecated code, can anyone help? Thanks!


THE CAKE IS A LIE

CrustySheet
CrustySheet
  • Member since: May. 3, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to converting AS1->AS2 script fails 2008-11-29 09:46:26 Reply

are you just trying to make the character face the other way?

Ghoul-5
Ghoul-5
  • Member since: Jul. 31, 2005
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to converting AS1->AS2 script fails 2008-11-29 10:54:03 Reply

Ah nevermind, it was a dumb mistake, the instance names are case sensitive, and i typed them in different cases. :P

Yes, the functions make sure, that two characters always face each other. (i'm making a fighting game)

So anyway, case closed.


THE CAKE IS A LIE