# Charactor is not hanging & jumping down properly?

**URL:** <https://forum.kirupa.com/t/charactor-is-not-hanging-jumping-down-properly/247523>\
**Category:** programming\
**Created:** [December 25, 2007, 10:49am UTC](https://forum.kirupa.com/t/charactor-is-not-hanging-jumping-down-properly/247523 "2007-12-25T10:49:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AS\_is\_Life](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@AS\_is\_Life](https://forum.kirupa.com/u/AS_is_Life)\
**Post date:** [December 25, 2007, 10:49am UTC](https://forum.kirupa.com/t/charactor-is-not-hanging-jumping-down-properly/247523/1 "2007-12-25T10:49:39Z")

</div>

Hi,

Guyes!

This is prafull, I am working on one platform type game where charactor will walk,jump in the air, hang on the ledge and again while pressing the up key he will climb up and stand on the ledge,he can walk on the ledge after ledge is finish he will jump down.

Please see the attach file and you will come to known what will be the problem.

Please guide me!

## Please see the code:

stop();  
Stage.showMenu = false;  
Stage.scaleMode = “noBorder”;  
//-----------------------------------------------------------------------------//  
//Variables & Ojectes//  
//-----------------------------------------------------------------------------//  
fscommand(“fullscreen”, true);  
fscommand(“showmenu”, false);  
score = 0;  
health.text = 100;  
en\_in = false;  
en\_out = false;  
hang = false;  
fast\_speed = 30;  
normal\_speed = 15;  
to\_run\_timeout = 4000;  
prev\_time = getTimer();  
current\_time = prev\_time;  
speed\_countdown\_timer = 0;  
document.frameRate = normal\_speed;  
enemy\_timeout = 12000;  
vel\_y = 0;  
accel = 4;  
jumping = false;  
hero\_bounds = new Object();  
hero\_bounds = hero.getBounds(this);  
t\_edge = hero\_bounds.xMin;  
b\_edge = hero\_bounds.yMin;  
curStage = 1;  
ground = 5;  
hero.climbing = false;  
enemy0.\_x = 1000;  
waitCount = 0;  
blinkCount = 0;  
hp = 100;  
Points = 0;  
lastCheckpoint = [];  
hanging1 = false;  
hanging2 = false;  
changeStage = false;  
walk = false;  
upFlage = false;  
jumpFlage = false;  
onTheLedge1 = false;  
onTheLedge2 = false;  
jumpDown = false;  
jumpup = false;  
//----------------------------------------------------------------------------//  
this.onLoad = function() {  
Direction = “Right”;  
};  
//----------------------------------------------------------------------------//  
this.onEnterFrame = function() {  
//trace(" Direction :"+Direction);  
origYpos = hero.\_y;  
//trace(“origYpos :”+origYpos);  
speed = normal\_speed;  
hpBar.\_xscale = hp;  
if (hp\<0) {  
hp = 0;  
if (hp == 0) {  
gotoAndStop(“End”);  
}  
}  
//-----------------------------------------------------------------------------//  
//Hero will Stand on the platform//  
//-----------------------------------------------------------------------------//  
if (platforms.hitTest(hero.\_x, hero.\_y+hero.\_height/2, true)) {  
platform = “on”;  
upFlage = false;  
}  
//-----------------------------------------------------------------------------//  
//check if enemy is hit//  
//-----------------------------------------------------------------------------//  
if (hero.hitTest(enemy0)) {  
Points = score;  
//gotoAndStop(“End”);  
}  
//-----------------------------------------------------------------------------//  
// If Hero hits the Ledge// //-----------------------------------------------------------------------------//  
for (t=1; t\<=6; t++) {  
if (hero.hitTest(eval(“s\_hit”+t))) {  
trace("???..");  
c\_l = eval(“s\_hit”+t);  
trace(“Name of the hiting thing :”+c\_l.\_name);  
if (curStage == 3) {  
hanging1 = false;  
hanging2 = false;  
jumpup = false;  
//trace(“hero collides with s\_hit from Right”);  
}  
}

}  
if (hero.hitTest(ledge\_wall1)) {  
jumpup = true;  
ledge\_wall1\_bounds = new Object();  
ledge\_wall1\_bounds = ledge\_wall1.getBounds(this);  
if (Direction == “Right”) {  
hanging1 = true;  
hanging2 = false;  
trace("hanging1 - “+hanging1);  
}  
if (Direction == “Left”) {  
hanging1 = false;  
}  
}  
if (hero.hitTest(ledge\_wall2)) {  
jumpup = true;  
ledge\_wall2\_bounds = new Object();  
ledge\_wall2\_bounds = ledge\_wall2.getBounds(this);  
trace(“hero hit the ledge\_wall2”);  
if (Direction == “Left”) {  
//if (hero\_bounds.xMin\<=ledge\_wall2\_bounds.xMax) {  
trace(” hit hanging2 will change - “+hanging2);  
hanging2 = true;  
hanging1 = false;  
}  
if (Direction == “Right”) {  
hanging2 = false;  
}  
}  
if (hero.hitTest(ledge\_wall3)) {  
jumpup = true;  
trace(“hero hit the ledge\_wall3”);  
ledge\_wall1\_bounds = new Object();  
ledge\_wall1\_bounds = ledge\_wall1.getBounds(this);  
if (Direction == “Right”) {  
hanging1 = true;  
hanging2 = false;  
}  
if (Direction == “Left”) {  
hanging1 = false;  
}  
}  
if (hero.hitTest(ledge\_wall4)) {  
jumpup = true;  
trace(“hero hit the ledge\_wall4”);  
ledge\_wall2\_bounds = new Object();  
ledge\_wall2\_bounds = ledge\_wall2.getBounds(this);  
if (Direction == “Left”) {  
//if (hero\_bounds.xMin\<=ledge\_wall2\_bounds.xMax) {  
trace(” hit hanging2 will change - "+hanging2);  
hanging2 = true;  
hanging1 = false;  
trace("hanging2 - "+hanging2);  
}  
if (Direction == “Right”) {  
hanging2 = false;  
}  
}  
if (hero.hitTest(ledge\_wall5)) {  
jumpup = true;  
trace(“hero hit the ledge\_wall5”);  
ledge\_wall1\_bounds = new Object();  
ledge\_wall1\_bounds = ledge\_wall1.getBounds(this);  
if (Direction == “Right”) {  
hanging1 = true;  
hanging2 = false;  
}  
if (Direction == “Left”) {  
hanging1 = false;  
}  
}  
if (hero.hitTest(ledge\_wall6)) {  
jumpup = true;  
trace(“hero hit the ledge\_wall6”);  
ledge\_wall2\_bounds = new Object();  
ledge\_wall2\_bounds = ledge\_wall2.getBounds(this);  
if (Direction == “Left”) {  
hanging2 = true;  
hanging1 = false;  
trace("hanging2 - "+hanging2);  
}  
if (Direction == “Right”) {  
hanging2 = false;  
}  
}  
for (i=1; i\<=ground; i++) {  
if (i == 1) {  
hero.hits = 0;  
}  
if (hero.hitTest(eval(“l”+i)) && jumpup) {  
hero.hits++;  
walk = false;  
Ledge = eval(“l”+i);  
l\_bounds = new Object();  
l\_bounds = Ledge.getBounds(this);  
if (hanging1) {  
if (Direction == “Right”) {  
//hero.\_x = l\_bounds.xMin-hero.\_width/2;  
hero.\_y = Ledge.\_y+hero.\_height-30;  
}  
}  
if (hanging2) {  
if (Direction == “Left”) {  
trace(“hero is hanging from the left side”);  
//hero.\_x = l\_bounds.xMax;  
hero.\_y = Ledge.\_y+hero.\_height-30;  
}  
}  
}  
}  
//------------------------------------------------------------------------//  
//Moving Left & Right//  
//-----------------------------------------------------------------------//  
if (Key.isDown(Key.LEFT) && !upFlage && !jumpDown) {  
walk = true;  
hero.\_xscale = -100;  
Direction = “Left”;  
//jumping = true;  
if (walk) {  
if (bg.\_x == 0) {  
curStage = 1;  
hero.\_xscale = -100;  
Direction = “Left”;  
//trace(“Direction :”+Direction);  
hero.gotoAndStop(curStage);  
}  
if (bg.\_x\>=-1) {  
speed = 0;  
curStage = 1;  
Direction = “Left”;  
hero.gotoAndStop(curStage);  
if (hero.anim.\_currentframe\>=hero.anim.\_totalframes) {  
curStage = 1;  
hero.gotoAndStop(curStage);  
}  
wall.\_x += speed;  
mb.\_x += speed;  
l.\_x += speed;  
for (i=1; i\<=32; i++) {  
eval(“f”+i).\_x += speed;  
eval(“l”+i).\_x += speed;  
eval(“ledge\_wall”+i).\_x += speed;  
eval(“s\_hit”+i).\_x += speed;  
eval(“ladder”+i).\_x += speed;  
}  
} else {  
if (onTheLedge1) {  
speed = normal\_speed;  
}  
curStage = 2;  
Direction = “Left”;  
hero.gotoAndStop(curStage);  
prev\_time = current\_time;  
current\_time = getTimer();  
dt = current\_time-prev\_time;  
speed\_countdown\_timer = speed\_countdown\_timer+dt;  
if (to\_run\_timeout\>speed\_countdown\_timer) {  
speed = normal\_speed;  
getDocumentDOM().frameRate = normal\_speed;  
} else {  
speed = fast\_speed;  
getDocumentDOM().frameRate = fast\_speed;  
}  
wall.\_x += speed;  
mb.\_x += speed;  
l.\_x += speed;  
for (c=1; c\<=32; c++) {  
eval(“f”+c).\_x += speed;  
eval(“l”+c).\_x += speed;  
eval(“ledge\_wall”+c).\_x += speed;  
eval(“s\_hit”+c).\_x += speed;  
eval(“ladder”+c).\_x += speed;  
}  
}  
if (bg.\_x\<=-1) {  
bg.\_x += speed;  
platforms.\_x += speed;  
}  
/_if (CurStage == 2 && !Key.isDown(Key.LEFT)) {  
trace(“Right key is releassed”);  
curStage = 1;  
hero.gotoAndStop(curStage);  
}_/  
}  
} else if (Key.isDown(Key.RIGHT) && !upFlage && !jumpDown) {  
//trace(upFlage);  
Direction = “Right”;  
walk = true;  
//jumping = true;  
hero.\_xscale = 100;  
if (walk) {  
if (onTheLedge) {  
//speed = 0;  
}  
if (bg.\_x+bg.\_width\<=670) {  
speed = 0;  
curStage = 1;  
bg.\_x += speed;  
platforms.\_x += speed;  
Direction = “Right”;  
hero.gotoAndStop(curStage);  
if (curStage == 2 && hero.anim.\_currentframe\>=hero.anim.\_totalframes) {  
curStage = 1;  
hero.gotoAndStop(curStage);  
//trace(“curStage :”+curStage);  
}  
wall.\_x += speed;  
mb.\_x += speed;  
l.\_x += speed;  
for (d=1; d\<=32; d++) {  
eval(“f”+d).\_x += speed;  
eval(“l”+d).\_x += speed;  
eval(“ledge\_wall”+d).\_x += speed;  
eval(“s\_hit”+d).\_x += speed;  
eval(“ladder”+d).\_x += speed;  
}  
} else {  
// normal walking on the level //  
if (onTheLedge) {  
//speed = normal\_speed;  
}  
prev\_time = current\_time;  
current\_time = getTimer();  
dt = current\_time-prev\_time;  
speed\_countdown\_timer = speed\_countdown\_timer+dt;  
if (to\_run\_timeout\>speed\_countdown\_timer) {  
speed = normal\_speed;  
document.frameRate = normal\_speed;  
} else {  
speed = fast\_speed;  
document.frameRate = fast\_speed;  
}  
Direction = “Right”;  
curStage = 2;  
hero.gotoAndStop(curStage);  
if (curStage == 2 && hero.anim.\_currentframe\>=hero.anim.\_totalframes) {  
curStage = 1;  
hero.gotoAndStop(curStage);  
}  
bg.\_x -= speed;  
platforms.\_x -= speed;  
wall.\_x -= speed;  
mb.\_x -= speed;  
l.\_x -= speed;  
for (e=1; e\<=32; e++) {  
eval(“f”+e).\_x -= speed;  
eval(“l”+e).\_x -= speed;  
eval(“ledge\_wall”+e).\_x -= speed;  
eval(“s\_hit”+e).\_x -= speed;  
eval(“ladder”+e).\_x -= speed;  
}  
if ((bg.\_x+bg.\_width) == 660) {  
curStage = 1;  
hero.gotoAndStop(curStage);  
}  
}  
/_if (CurStage == 2 && !Key.isDown(Key.RIGHT)) {  
trace(“Right key is releassed”);  
curStage = 1;  
hero.gotoAndStop(curStage);  
}_/  
}  
} else if (!Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT) && !upFlage && curStage == 2) {  
walk = false;  
if (!walk) {  
curStage = 1;  
hero.gotoAndStop(curStage);  
}  
}  
//-----------------------------------------------------------------------------//  
//Falling down//  
//-----------------------------------------------------------------------------//  
if (gravity == “on” && platform == “off” && !jumping) {  
hero.\_y = hero.\_y+12;  
hero.\_y = origYpos;  
jumping = true;  
//trace(“Ypos of the hero :”+hero.\_y);  
}  
//----------------------------------------------------------------------------//  
//Jumping//  
//---------------------------------------------------------------------------//  
if (hero.hits\<=0) {  
//trace(hero.hits);  
if (Key.isDown(Key.UP) && !jumping && !walk) {  
upFlage = true;  
//trace(“hero Direction while juming :”+Direction);  
if (upFlage) {  
curStage = 3;  
platform = “no”;  
vel\_y = 22;  
jumping = true;  
walk = false;  
//trace(Direction);  
if (Direction == “Left”) {  
if (bg.\_x\>=-1) {  
//speed = 0;  
bg.\_x += speed;  
for (g=1; g\<=32; g++) {  
eval(“f”+g).\_x += speed;  
eval(“l”+g).\_x += speed;  
eval(“ledge\_wall”+g).\_x += speed;  
eval(“s\_hit”+g).\_x += speed;  
eval(“ladder”+g).\_x += speed;  
}  
wall.\_x += speed;  
l.\_x += speed;  
mb.\_x += speed;  
} else {  
bg.\_x += speed;  
platforms.\_x += speed;  
for (g=1; g\<=32; g++) {  
eval(“f”+g).\_x += speed;  
eval(“l”+g).\_x += speed;  
eval(“ledge\_wall”+g).\_x += speed;  
eval(“s\_hit”+g).\_x += speed;  
eval(“ladder”+g).\_x += speed;  
}  
wall.\_x += speed;  
l.\_x += speed;  
mb.\_x += speed;  
}  
}  
if (Direction == “Right”) {  
if (bg.\_x+bg.\_width\<=670) {  
//speed = 0;  
bg.\_x -= speed;  
platforms.\_x -= speed;  
for (j=1; j\<=32; j++) {  
eval(“f”+j).\_x -= speed;  
eval(“l”+j).\_x -= speed;  
eval(“ledge\_wall”+j).\_x -= speed;  
eval(“s\_hit”+j).\_x -= speed;  
eval(“ladder”+j).\_x -= speed;  
}  
wall.\_x -= speed;  
l.\_x -= speed;  
mb.\_x -= speed;  
} else {  
bg.\_x -= speed;  
platforms.\_x -= speed;  
for (h=1; h\<=32; h++) {  
eval(“f”+h).\_x -= speed;  
eval(“l”+h).\_x -= speed;  
eval(“ledge\_wall”+h).\_x -= speed;  
eval(“s\_hit”+h).\_x -= speed;  
eval(“ladder”+h).\_x -= speed;  
}  
wall.\_x -= speed;  
l.\_x -= speed;  
mb.\_x -= speed;  
}  
}  
}  
}  
//---------------------------------------------------------------------//  
//Make to fall down//  
//---------------------------------------------------------------------//  
if (jumping == true) {  
if (platform == “on”) {  
gravity = “on”;  
vel\_y = 0;  
jumping = false;  
//hero.\_y = origYpos;  
curStage = 1;  
hero.gotoAndStop(curStage);  
} else {  
//trace(hero.\_y);  
//trace(“origXpos :”+origXpos);  
//hero.\_y = origXpos;  
gravity = “off”;  
//hero.\_y = origYpos;  
}  
//-------------------------------------------------------------//  
//Make to jump up//  
//------------------------------------------------------------//  
vel\_y -= accel;  
if (vel\_y\<-12) {  
vel\_y = -12;  
}  
hero.\_y -= vel\_y;  
hero.gotoAndStop(curStage);  
}  
}  
//---------------------------------------------------------------------//  
if (hero.hits\>0) {  
if (Key.isDown(Key.UP) && upFlage && !walk) {  
//trace(“hero is hanging from the right side”);  
if (Direction == “Right”) {  
//hero.\_x = Ledge.\_x+hero.\_width-35;  
//trace(“Going Right”);  
platform = “on”;  
curStage = 5;  
hero.gotoAndStop(curStage);  
//hero.\_x = Ledge.\_x+hero.\_width;  
hero.\_y = Ledge.\_y+hero.\_height/2;  
L\_Ypos = hero.\_y;  
upFlage = false;  
onTheLedge1 = true;  
//speed = 0;  
}  
if (Direction == “Left”) {  
trace(“Going Left”);  
platform = “on”;  
curStage = 5;  
hero.gotoAndStop(curStage);  
[//hero.clim](https://hero.clim).\_x = Ledge.\_x;  
//hero.\_x = Ledge.\_x+Ledge.\_width;  
hero.\_y = Ledge.\_y+hero.\_height/2;  
L\_Ypos = hero.\_y;  
//upFlage = false;  
onTheLedge1 = true;  
//speed = 0;  
}  
}  
if (onTheLedge1) {  
//trace(“hero’s Stage :”+curStage);  
if (hero.clim.\_currentframe == hero.clim.\_totalframes) {  
//trace(“move the hero left right”);  
//hanging2 = false;  
//jumping = false;  
if (Direction == “Right”) {  
upFlage = false;  
//hanging1 = false;  
//hanging2 = false;  
//hero.\_x = Ledge.\_x;  
hero.\_y = L\_Ypos+hero.\_height/2-50;  
}  
if (Direction == “Left”) {  
upFlage = false;  
//hanging1 = false;  
//hanging2 = false;  
//hero.\_x = Ledge.\_x;  
hero.\_y = L\_Ypos+hero.\_height/2-50;  
}  
}  
}  
if (Key.isDown(Key.LEFT) && !upFlage && !jumpDown) {  
trace(“hero position walking on the ledge :”+Ledge.\_x);  
//walk = true;  
speed = 0;  
platform = “on”;  
//hero.\_xscale = -100;  
curStage = 2;  
hero.gotoAndStop(curStage);  
//hero.\_x = Ledge.\_x+hero.\_width/2;  
hero.\_y = L\_Ypos-hero.\_height;  
if (onTheLedge1) {  
//speed = 0;  
}  
}  
if (Key.isDown(Key.RIGHT) && !upFlage && !jumpDown) {  
speed = 0;  
platform = “on”;  
curStage = 2;  
hero.gotoAndStop(curStage);  
hero.\_y = L\_Ypos-hero.\_height;  
if (onTheLedge1) {  
//speed = 0;  
}  
}  
if (curStage == 1) {  
hero.\_y = L\_Ypos-hero.\_height+10;  
trace(“hero has to go up”);  
}  
}  
//---------------------------------------------------------------------//  
if (onTheLedge1) {  
if (hero.hitTest(ledge\_wall8) || hero.hitTest(ledge\_wall10) || hero.hitTest(ledge\_wall12)) {  
if (Direction == “Right”) {  
jumpDown = true;  
upFlage = true;  
hero.\_xscale = 100;  
curStage = 6;  
hero.\_y = hero.\_y-hero.\_height/2+55;  
hero.gotoAndStop(curStage);  
if (hero.g\_j\_d.\_currentframe\>=hero.g\_j\_d.\_totalframes) {  
jumpDown = true;  
upFlage = true;  
}  
}  
} else if (hero.hitTest(ledge\_wall7) || hero.hitTest(ledge\_wall9) || hero.hitTest(ledge\_wall11)) {  
if (Direction == “Left”) {  
jumpDown = true;  
upFlage = true;  
hero.\_xscale = -100;  
curStage = 6;  
hero.\_y = hero.\_y-hero.\_height/2+55;  
hero.gotoAndStop(curStage);  
if (hero.g\_j\_d.\_currentframe\>=hero.g\_j\_d.\_totalframes) {  
jumpDown = true;  
upFlage = true;  
}  
}  
}  
}

//---------------------------------------------------------------------//  
if (curStage == 6 && platforms.hitTest(hero)) {  
hero.hits = 0;  
platform = “on”;  
onTheLedge1 = false;  
hanging1 = false;  
hanging2 = false;  
onTheLedge2 = false;  
upFlage = false;  
jumpDown = false;  
jumpup = false;  
hero.\_y = (platforms.\_y-platforms.\_height)-hero.\_height;  
p\_ypos = hero.\_y;  
p\_xpos = hro.\_x;  
if (platform == “on” && Direction == “Right”) {  
jumping = false;  
if (hero.g\_j\_d.\_currentframe == hero.g\_j\_d.\_totalframes) {  
trace("///hero Xpos///"+hero.\_x);  
hero.\_xscale = 100;  
curStage = 1;  
hero.gotoAndStop(curStage);  
hero.\_x = hero.\_x+Ledge.\_width-hero.\_width;  
hero.\_y = hero.\_y+hero.\_height/2-10;  
}  
}  
if (platform == “on” && Direction == “Left”) {  
jumping = false;  
if (hero.g\_j\_d.\_currentframe == hero.g\_j\_d.\_totalframes) {  
trace("///hero Xpos///"+hero.\_x);  
hero.\_xscale = -100;  
curStage = 1;  
hero.gotoAndStop(curStage);  
hero.\_x = hero.\_x-Ledge.\_width+hero.\_width;  
hero.\_y = hero.\_y+hero.\_height/2-10;  
}  
}

}  
//---------------------------------------------------------------------//  
if (Key.isDown(Key.SPACE) && !walk && !jumping) {  
for (p=1; p\<=19; p++) {  
if (hero.hitTest(eval(“f”+p))) {  
products = eval(“f”+p);  
f\_bounds = new Object();  
f\_bounds = products.getBounds(this);  
//trace(“Direction :”+Direction);  
if (Direction == “Left”) {  
//trace("hero hit the plate from left1 ");  
if ((products.\_x+products.\_width/2-60)\<=(hero.\_x+hero.\_width/2-40)) {  
//trace(“hero hit the plate from left 2”);  
food = eval(“f”+p);  
score += 5;  
lastCheckpoint[p-1] = food.\_name;  
eval(“f”+p).gotoAndStop(2);  
}  
}  
if (Direction == “Right”) {  
//curStage == 1 &&  
if ((products.\_x+products.\_width/2-60)\>=(hero.\_x+hero.\_width/2)) {  
//trace("hero will eat the plate R ");  
food = eval(“f”+p);  
score += 5;  
lastCheckpoint[p-1] = food.\_name;  
eval(“f”+p).gotoAndStop(2);  
}  
}  
}  
}  
}  
//-------------------------------------------------------------------//  
//Enemy move//  
//------------------------------------------------------------------//  
if (hero.hitTest(wall)) {  
if (Direction == “Right” && enemy\_timeout\>speed\_countdown\_timer) {  
//en\_in = true;  
//enemy0.\_xscale = 100;  
} else {  
//en\_in = false;  
}  
}  
if (en\_in) {  
//waitCount++;  
enemy0.ene\_run.q\_r.\_visible = true;  
enemy0.gotoAndStop(“a”);  
enemy0.\_x -= speed;  
if (hero.hitTest(platforms) && en\_in || !en\_in) {  
enemy0.ene\_run.q\_r.\_visible = true;  
enemy0.ene\_stand.q\_r.\_visible = true;  
enemy0.ene\_run.q\_g.\_visible = false;  
enemy0.ene\_stand.q\_g.\_visible = false;  
} else {  
enemy0.ene\_run.q\_g.\_visible = true;  
enemy0.ene\_stand.q\_g.\_visible = true;  
enemy0.ene\_run.q\_r.\_visible = false;  
enemy0.ene\_stand.q\_r.\_visible = false;  
}  
if (enemy0.\_x\<=200) {  
enemy0.gotoAndStop(“b”);  
en\_in = false;  
[//enemy0.q](https://enemy0.q).\_visible = true;  
//enemy0.\_x = enemy0.\_x;  
//waitCount++;  
}  
if (enemy0.\_x\<=950) {  
blink.gotoAndStop(2);  
//trace(“blinkCount :”+blinkCount);  
if (blinkCount == 10) {  
blink.gotoAndStop(1);  
}  
}  
}  
if (waitCount == 60) {  
//en\_in = true;  
enemy0.\_xscale = -100;  
[//enemy0.q](https://enemy0.q).\_visible = false;  
enemy0.gotoAndStop(“a”);  
enemy0.\_x += speed;  
//waitCount = 0;  
if (enemy0.\_x\>800) {  
waitCount = 0;  
en\_in = false;  
enemy0.gotoAndStop(“b”);  
enemy0.\_xscale = 100;  
en\_in = true;  
}  
if (hero.hitTest(platforms) && en\_in || !en\_in) {  
//enemy0.q\_r.\_visible = true;  
//trace("Hero is on the platform ");  
//en\_in = true;  
//enemy0.\_xscale = 100;  
[//enemy0.gotoAndStop](https://enemy0.gotoAndStop)(“a”);  
//enemy0.\_x -= 10;  
} else {  
//enemy0.q\_r.\_visible = false;  
}  
}  
//------------------------------------------------------------------//  
ladder = “off”;  
platform = “off”;  
gravity = “on”;  
};  
//---------------------------------------------------------------------//  
this.onKeyUp = function() {  
speed\_countdown\_timer = 0;  
speed = normal\_speed;  
if (Key.getCode() == 83) {  
jumping = false;  
}  
};  
//--------------------------------------------------------------------//

* * *

Thank’s for spending some time for me!.

Regards.  
Prafull.
