Be a Supporter!

Help Urgent

  • 284 Views
  • 3 Replies
New Topic Respond to this Topic
Minchken
Minchken
  • Member since: Jan. 17, 2011
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Help Urgent 2012-02-01 02:20:47 Reply

Everything was going good on my flash, but then I thought "hey I need a preloader" So I got one and put it behind scene one making it Scene 2 then Scene one. and now whenever I play it my character wont stop doing a walking animation. HELP ME PLEASE

My code for my character:

onClipEvent (load) {
var speed:Number = 0;
var walk:Number = 6;
var run:Number = 11;
var grav:Number = 0;
var falling:Number = 0;
var jumped:Boolean = false;
var jumpHeight:Number = 21;
var touchingGround:Boolean = false;
var scale:Number = _xscale;
var doorOpened:Boolean = false;
var attacked:Boolean = false;
}
onClipEvent (enterFrame) {
if (!touchingGround) {
grav++;
this._y += grav;
} else {
grav = 0;
}
if (_root.ground.hitTest(_x, _y, true)) {
touchingGround = true;
} else {
touchingGround = false;
}
if (!attacked) {
if (Key.isDown(Key.LEFT)) {
_x -= speed;
this.gotoAndStop(2);
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
this.gotoAndStop(2);
_xscale = +scale;
}
if (Key.isDown(Key.SHIFT)) {
speed = run;
} else {
speed = walk;
}
}
}
onClipEvent (enterFrame) {
if (!attacked) {
if (jumped) {
falling += 0.5;
_y += falling;
if (touchingGround) {
jumped = false;
}
} else {
if (Key.isDown(Key.UP)) {
jumped = true;
falling = -jumpHeight;
this.gotoAndStop(3);
}
}
}
if ((Key.isDown(Key.UP)) and (Key.isDown(Key.LEFT))) {
this.gotoAndStop(3);
}
if ((Key.isDown(Key.UP)) and (Key.isDown(Key.RIGHT))) {
this.gotoAndStop(3);
}
if ((!Key.isDown(Key.UP)) and (!touchingGround)) {
this.gotoAndStop(3);
} else if ((Key.isDown(Key.UP)) and (!touchingGround)) {
this.gotoAndStop(3);
}
if ((_currentframe == 3) and (touchingGround)) {
gotoAndStop(1);
}
}
onClipEvent (keyUp) {
if (!attacked) {
gotoAndStop(1);
}
}
onClipEvent (enterFrame) {
if ((this.hitTest(_root.door)) and (!doorOpened)) {
this._x -= speed;
}
if ((this.hitTest(_root.door)) and (Key.isDown(Key.SPACE)) and (_root.keys>=1)) {
_root.door.gotoAndStop(2);
doorOpened = true;
_root.keys -= 1;
}
if (this.hitTest(_root.wall)) {
this._x -= speed;
}
if (this.hitTest(_root.key)) {
_root.keys += 1;
unloadMovie(_root.key);
}
if (_root.keys<0) {
_root.keys = 0;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(65)){
attacked = true;
this.gotoAndStop(4);
if(this.hitTest(_root.enemy)) {
_root.enemy.unloadMovie();
}
}
}


I love Dawn from Pokemon.

BBS Signature
Sandremss128
Sandremss128
  • Member since: Aug. 22, 2009
  • Offline.
Forum Stats
Supporter
Level 11
Programmer
Response to Help Urgent 2012-02-01 05:43:38 Reply

At 2/1/12 02:20 AM, Minchken wrote: Everything was going good on my flash, but then I thought "hey I need a preloader"

Dont decide to build in a preloader in the middle of your project.

So I got one and put it behind scene one making it Scene 2 then Scene one.

Dont use scenes when you are working with actionscript.

My code for my character:

In your last fail post there were some people saying you should use code tags. If you are not going to listen to others why would people listen to you?

//worthless untagged code

Looking at 'your' code I have the following to say:
1. Dont use actionscript 2.0 if you want to learn flash.
2. Dont copy code and cry when you break it.
3. Dont place code on MovieClips.

Just go learn actionscript and come back when you encounter problems. If you make your own code and something goes wrong with it you KNOW where it goes wrong most of the time because you made it yourself. Just dont put 0 effort and time into a post and expect serious input from others.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Online!
Forum Stats
Moderator
Level 13
Programmer
Response to Help Urgent 2012-02-01 09:34:40 Reply

Don't create four onEnterFrame functions. You should only have one.

Nae
Nae
  • Member since: Jan. 14, 2009
  • Offline.
Forum Stats
Member
Level 01
Artist
Response to Help Urgent 2012-02-01 13:22:35 Reply

Hi, could you please title your threads better a...nd not make duplicate/repeat threads just because you're not getting the responses you want. Thanks.


"Why do you hide, stupid aliens? Mr. Zurkon only wishes for to kill you."

BBS Signature