I know this no the best post. im not actualy expecting a response
How ever if some one has had experience with using ladders in a platform game. As this way could be possible. if i could say if touch ladder_one or ladder two hittest == true for both values not just 1
i dont think i can use an array. with the example below.
of the variable(player_on_ladder checks wether the player has touched a ladder.
Now the problem is the player is touching the first ladder, however is not touching the second ladder.
which returns
This fine when i want the player to climb the ladder. however i want to make the player when not touching the ladder
fall towards the ground. So created both variable to check wether the player has touched the ladder and
then is not touching the ladder. When the player touches the ladder the loop checks and returns ladder one has touched(true)
and Ladder_two not touched and the value is false.
as true and false. This is correct
ActionScript Code:
var ladder = new Array(ladder_one,ladder_two);
var player_on_ladder:Boolean = false;
var ladderTouches:Number = 0;
player.onEnterFrame = function(){
for(var i=0; i < ladder.length; i ++){
// climbs the ladder if player on ladder
if(player.hitTest(ladder[i])){
player_on_ladder = true;
textLadder.text = player_on_ladder;
trace("hit =" + ladder[i]);
ladderTouches = 1;
// problem which is correct //output panel .
// value returned true and false table_one is touched and table_two is not touched.
// making the variable
}else if(!player.hitTest(ladder[i])){
player_on_ladder = false;
textLadder.text = player_on_ladder;
trace(player_on_ladder);
}
// make player go up the ladder when touching the ladder
if(Key.isDown(Key.UP)and player_on_ladder == true){
player._y -=5;
}
// make player climb down the ladder when touching the ladder
if(Key.isDown(Key.DOWN)and player_on_ladder == true){
player._y +=5;
//player not on ladder
//______________________________________________________player fall when after touching and decides to leave halfway point________
}else if(player_on_ladder == false and ladderTouches == 1){
player._y +=3;
// now here lie my problem as the output panel is showing.
// this correct however this why cant work at the moment.
}
}
}