speedlemon
07-10-2004, 10:58 PM
i wanted to make a guy walk around similar to rpg maker 2000/2003.
i have a mc that is set up like this.
frames 1-3 : walking down
frames 4-6 : walking left
frames 7-9 : walking up
frames 10-12 : walking right
and i have this code to make it do the animations. (havent implemented walking yet. ;) ). for some reason this doesnt work? i was wondering if someone could show me why. please dont tell me how i could do it a better way or something. im new to actionscript, and i thought of this way all by myself so i understand it the most. :cool:
oh btw-
direction 3 = down
direction 4 = left
direction 1 = up
direction 2 = right
k?
onClipEvent (load) {
curframe = 1;
direction = 3;
}
onClipEvent (enterFrame) {
if (curframe=1) {
if (direction=3) {
gotoAndStop(2);
curframe = 2;
}
if (direction=4) {
gotoAndStop(5);
curframe = 2;
}
if (direction=1) {
gotoAndStop(8);
curframe = 2;
}
if (direction=2) {
gotoAndStop(11);
curframe = 2;
}
}
if (curframe=2) {
if (direction=3) {
gotoAndStop(3);
curframe = 3;
}
if (direction=4) {
gotoAndStop(6);
curframe = 3;
}
if (direction=1) {
gotoAndStop(9);
curframe = 3;
}
if (direction=2) {
gotoAndStop(12);
curframe = 3;
}
}
if (curframe=3) {
if (direction=3) {
gotoAndStop(1);
curframe = 1;
}
if (direction=4) {
gotoAndStop(4);
curframe = 1;
}
if (direction=1) {
gotoAndStop(7);
curframe = 1;
}
if (direction=2) {
gotoAndStop(10);
curframe = 1;
}
}
}
i have a mc that is set up like this.
frames 1-3 : walking down
frames 4-6 : walking left
frames 7-9 : walking up
frames 10-12 : walking right
and i have this code to make it do the animations. (havent implemented walking yet. ;) ). for some reason this doesnt work? i was wondering if someone could show me why. please dont tell me how i could do it a better way or something. im new to actionscript, and i thought of this way all by myself so i understand it the most. :cool:
oh btw-
direction 3 = down
direction 4 = left
direction 1 = up
direction 2 = right
k?
onClipEvent (load) {
curframe = 1;
direction = 3;
}
onClipEvent (enterFrame) {
if (curframe=1) {
if (direction=3) {
gotoAndStop(2);
curframe = 2;
}
if (direction=4) {
gotoAndStop(5);
curframe = 2;
}
if (direction=1) {
gotoAndStop(8);
curframe = 2;
}
if (direction=2) {
gotoAndStop(11);
curframe = 2;
}
}
if (curframe=2) {
if (direction=3) {
gotoAndStop(3);
curframe = 3;
}
if (direction=4) {
gotoAndStop(6);
curframe = 3;
}
if (direction=1) {
gotoAndStop(9);
curframe = 3;
}
if (direction=2) {
gotoAndStop(12);
curframe = 3;
}
}
if (curframe=3) {
if (direction=3) {
gotoAndStop(1);
curframe = 1;
}
if (direction=4) {
gotoAndStop(4);
curframe = 1;
}
if (direction=1) {
gotoAndStop(7);
curframe = 1;
}
if (direction=2) {
gotoAndStop(10);
curframe = 1;
}
}
}