still continueCode:function moveTiles() { for (var i = 0; i<game.movingtiles.length; i++) { var ob = game["movingtiles"+i]; getMyCorners(ob.x+ob.speed*ob.dirx, ob.y+ob.speed*ob.diry, ob); if (ob.miny>ob.upY or ob.maxy<ob.downY) { ob.diry = -ob.diry; } if (ob.minx>ob.leftX or ob.maxx<ob.rightX) { ob.dirx = -ob.dirx; } ob.x = ob.x+ob.speed*ob.dirx; ob.y = ob.y+ob.speed*ob.diry; ob.xtile = Math.floor(ob.x/game.tileW); ob.ytile = Math.floor(ob.y/game.tileH); ob.clip._x = ob.x; ob.clip._y = ob.y; if (ob.diry == -1) { checkMovingTiles(0); } } if (char.onMovingTile) { getMyCorners(char.x, char.y+char.onMovingTile.speed*char.onMovingTile.diry, char); if (char.onMovingTile.diry == -1) { if (char.upleft and char.upright) { char.y = char.onMovingTile.y-char.onMovingTile.height-char.height; } else { char.y = char.ytile*game.tileH+char.height; char.jumpspeed = 0; char.jump = true; char.onMovingTile = false; } } if (char.onMovingTile.diry == 1) { if (char.downleft and char.downright) { char.y = char.onMovingTile.y-char.onMovingTile.height-char.height; } else { char.onMovingTile = false; char.y = (char.ytile+1)*game.tileH-char.height; } } getMyCorners(char.x+char.onMovingTile.speed*char.onMovingTile.dirx, char.y, char); if (char.onMovingTile.dirx == -1) { if (char.downleft and char.upleft) { char.x += char.onMovingTile.speed*char.onMovingTile.dirx; } else { char.x = char.xtile*game.tileW+char.width; fall(ob); } } if (char.onMovingTile.dirx == 1) { if (char.upright and char.downright) { char.x += char.onMovingTile.speed*char.onMovingTile.dirx; } else { fall(ob); char.x = (char.xtile+1)*game.tileW-char.width; } } updateChar(ob); } } function detectKeys() { moveTiles(); var ob = _root.char; var keyPressed = false; if (Key.isDown(Key.SPACE) and !ob.jump and !ob.climb) { ob.onMovingTile = false; ob.jump = true; ob.jumpspeed = ob.jumpstart; } if (Key.isDown(Key.RIGHT)) { getMyCorners(ob.x-ob.speed, ob.y, ob); if (!ob.climb or ob.downleft and ob.upleft and ob.upright and ob.downright) { if (!checkMovingTiles(1)) { char.onMovingTile = false; } keyPressed = _root.moveChar(ob, 1, 0); } } else if (Key.isDown(Key.LEFT)) { getMyCorners(ob.x-ob.speed, ob.y, ob); if (!ob.climb or ob.downleft and ob.upleft and ob.upright and ob.downright) { if (!checkMovingTiles(1)) { char.onMovingTile = false; } keyPressed = _root.moveChar(ob, -1, 0); } } else if (Key.isDown(Key.UP)) { if (!ob.jump and checkUpLadder(ob)) { keyPressed = _root.climb(ob, -1); } } else if (Key.isDown(Key.DOWN)) { if (!ob.jump and checkDownLadder(ob)) { keyPressed = _root.climb(ob, 1); } } if (ob.jump) { keyPressed = _root.jump(ob); } if (!keyPressed) { ob.clip.char.gotoAndStop(1); } else { ob.clip.char.play(); } } buildMap(_root["myMap"+game.currentMap]); fall(_root.char); stop();




Reply With Quote