The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsI need to make it so my guy faces the same way when you let go of the key
code 1:
code 2: onClipEvent (enterFrame) {
if (!Key.isDown(Key.LEFT)) {
this._y -= speed;
this.gotoAndStop(1);
} else {
this.play();
}
}
swf: http://www.newgrounds.com/dump/item/d5ef de373995266c401cd5d71a700c09 (arrow keys to move)
At 2/18/10 07:36 PM, up-a-notch wrote: I need to make it so my guy faces the same way when you let go of the key
code 1:
code 2: onClipEvent (enterFrame) {
if (!Key.isDown(Key.LEFT)) {
this._y -= speed;
this.gotoAndStop(1);
} else {
this.play();
}
}
swf: http://www.newgrounds.com/dump/item/d5ef de373995266c401cd5d71a700c09 (arrow keys to move)
you needto lookinto _xscale
you wantto change it
_xscale = 100
_xscale = -100
stuff likethat in left and right
At 2/18/10 07:36 PM, up-a-notch wrote: I need to make it so my guy faces the same way when you let go of the key
What do you mean? Could you maybe make an example or explain that more thoroughly? It's hard to know what you're having problems with.
Also, post all relevant code that would be useful in fixing your problem. You should use code tags as well.
ok here
code on guy:
onClipEvent (load) {
speed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += speed;
this.gotoAndStop(3);
}
if (Key.isDown(Key.LEFT)) {
this._x -= speed;
this.gotoAndStop(2);
}
if (Key.isDown(83)) {
this.gotoAndStop(4);
}
if (Key.isDown(65)) {
this.gotoAndStop(5);
}
if (Key.isDown(68)) {
this.gotoAndStop(6);
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop(8);
}
if (Key.isDown(83)) {
this.gotoAndStop(4);
}
}
codes inside guy:
code 1:
onClipEvent (enterFrame) {
if (!Key.isDown(Key.LEFT)) {
this._y -= speed;
_xscale = -100;
} else {
this.play();
}
}
code 2:
onClipEvent (enterFrame) {
if (!Key.isDown(Key.RIGHT)) {
this._y -= speed;
_xscale = 100;
} else {
this.play();
}
} i don't even understand what you want still. could you explain what your asking better?
when you let go of moving the guy faces right so it is a problem if you are running left
logically.. you probably want to set a facing direction for your character, so when you let go of an arrow key, you know which direction he was walking last. I use 0, 1, 2, 3... left up right down.
when the key is up, you gotoAndStop(IDLE_DIRECTION); simple AS pie... lol... AS
it says it has errors!
onClipEvent (load) {
speed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += speed;
this.gotoAndStop(3);
}
if (Key.isDown(Key.LEFT)) {
this._x -= speed;
this.gotoAndStop(2);
}
if (Key.isToggled((Key.LEFT)) {
gotoAndStop(IDLE_DIRECTION);
}
if (Key.isToggled((Key.RIGHT)) {
gotoAndStop(IDLE_DIRECTION);
}
if (Key.isDown(83)) {
this.gotoAndStop(4);
}
if (Key.isDown(65)) {
this.gotoAndStop(5);
}
if (Key.isDown(68)) {
this.gotoAndStop(6);
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop(8);
}
if (Key.isDown(83)) {
this.gotoAndStop(4);
}
}
onClipEvent (enterFrame) {
if (jumping) {
_y += jumpspeed;
jumpspeed += 1;
if (_y>=y_start) {
_y = y_start;
jumping = false;
}
} else {
if (Key.isDown(Key.SPACE)) {
jumping = true;
jumpspeed = -14;
this.gotoAndStop(7);
}
}
} Just have the character face the same way for both moving right and left and use _xscale to determine which direction you face.
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += speed;
this._xscale=100
this.gotoAndStop(3);
}
if (Key.isDown(Key.LEFT)) {
this._x -= speed;
this._xscale=-100
this.gotoAndStop(3);
}
} :'(
look what happens: http://www.newgrounds.com/dump/item/a2d8 e1eaaea8306768730ca01fb96c70