# Stick game

**URL:** <https://forum.kirupa.com/t/stick-game/276398>\
**Category:** programming\
**Created:** [November 26, 2008, 5:16pm UTC](https://forum.kirupa.com/t/stick-game/276398 "2008-11-26T17:16:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam\_vickery](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sam\_vickery](https://forum.kirupa.com/u/sam_vickery)\
**Post date:** [November 26, 2008, 5:16pm UTC](https://forum.kirupa.com/t/stick-game/276398/1 "2008-11-26T17:16:16Z")

</div>

I have made a simple background, and a person that can walk, jump and duck and is suposed to climb when it hits a ladder. But it doesnt ☹

I have tried everything and still cant seem to find where I have gone wrong. I know that the way I have written the code isnt great, but I am still learning. I have made an array for the ladders and they work fine as I have tested them. Its just when I use the line if(Key.isDown(Key.UP)&&doing==false&&ladder==true){} thats the but that doesnt work.  
If any one could have a look at the code and point me in the right direction it would be great.  
cheers

```auto
var climbspeed = 2;
var doing = false;
var ladderarray = [];
this.onEnterFrame = function() {
 if (Key.isDown(Key.LEFT) && doing == false) {
  _root.char.gotoAndStop("walk");
  speed = -1;
  _root.char._xscale = -100;
  doing = true;
 } else {
  if (Key.isDown(Key.RIGHT) && doing == false) {
   _root.char.gotoAndStop("walk");
   _root.char._xscale = 100;
   speed = 1;
   doing = true;
  } else {
   if (Key.isDown(Key.UP) && doing == false && ladder == false) {
    _root.char.gotoAndStop("jump");
    doing = true;
   } else {
    if (Key.isDown(Key.DOWN) && doing == false) {
     _root.char.gotoAndStop("duck");
     doing = true;
    } else {
     if (Key.isDown(Key.UP) && doing == false && ladder == true) {
      _root.char.gotoAndStop("climb");
      _root.char._y -= climbspeed;
     }
    }
   }
  }
 }
 for (var i = 0; i<ladderarray.length; i++) {
  if (ladderarray*.hitTest(_root.char)) {
   ladder = true;
  } else {
   ladder = false;
  }
 }
};

```
