function make_move($array) { // $player = making($move, 0, NULL); $player = unserialize($_SESSION['player_obj']); $ships = $player->getShips(); $ship = $ships[$_SESSION['index_ship']]; $grid = get_board(); // $grid = $_SESSION['board']; $pos = $ship->getPos(); $dim = $ship->getDim(); if (isset($array['ship_orientation']) && $array['ship_orientation'] === "left") { if ($ship->getOrientation() === "0deg") { $ship->setOrientation("-90deg"); } else { if ($ship->getOrientation() === "-90deg") { $ship->setOrientation("180deg"); } else { if ($ship->getOrientation() === "180deg") { $ship->setOrientation("90deg"); } else { if ($ship->getOrientation() === "90deg") { $ship->setOrientation("0deg"); } } } } } else { if (isset($array['ship_orientation']) && $array['ship_orientation'] === "right") { if ($ship->getOrientation() === "0deg") { $ship->setOrientation("90deg"); } else { if ($ship->getOrientation() === "-90deg") { $ship->setOrientation("0deg"); } else { if ($ship->getOrientation() === "180deg") { $ship->setOrientation("-90deg"); } else { if ($ship->getOrientation() === "90deg") { $ship->setOrientation("180deg"); } } } } } } if ($ship->getOrientation() === "90deg") { $y = $pos[1] + intval($array['deplacement']); $dim = array_reverse($dim); $ship->setDim($dim); if ($y < 100 && check_collision($grid, $pos[0], $y, $dim, $ship->getId()) === -1) { $ship->setPos(array($pos[0], $y)); } else { $ship->setHealth(-1000); } } else { if ($ship->getOrientation() === "-90deg") { $y = $pos[1] - intval($array['deplacement']); $dim = array_reverse($dim); $ship->setDim($dim); if ($y >= 0 && check_collision($grid, $pos[0], $y, $dim, $ship->getId()) === -1) { $ship->setPos(array($pos[0], $y)); } else { $ship->setHealth(-1000); } } else { if ($ship->getOrientation() === "0deg") { $y = $pos[0] + intval($array['deplacement']); if ($y < 150 && check_collision($grid, $y, $pos[1], $dim, $ship->getId()) === -1) { $ship->setPos(array($y, $pos[1])); } else { $ship->setHealth(-1000); } } else { if ($ship->getOrientation() === "180deg") { $y = $pos[0] - intval($array['deplacement']); if ($y >= 0 && check_collision($grid, $y, $pos[1], $dim, $ship->getId()) === -1) { $ship->setPos(array($y, $pos[1])); } else { $ship->setHealth(-1000); } } } } } $_SESSION['player_obj'] = $player->getSerial(); include 'connection.php'; $pl_serial = "player_" . $_SESSION['player_id'] . "_obj='" . $_SESSION['player_obj'] . "'"; $req = "UPDATE `party` SET {$pl_serial} WHERE `id`=" . $_SESSION['id_party'] . ""; $bdd->exec($req); }
function make_fire() { $player = unserialize($_SESSION['player_obj']); $pa = unserialize($_SESSION['asteroid']); $tab = get_board(); $range = 35; $bol = 1; $pos = $player->ships[$_SESSION['index_ship']]->getPos(); $or = $player->ships[$_SESSION['index_ship']]->getOrientation(); if ($or == "right") { right_fire($pos, $range, $tab, $player, $pa, $bol); } else { if ($or == "left") { left_fire($pos, $range, $tab, $player, $pa, $bol); } else { if ($or == "up") { up_fire($pos, $range, $tab, $player, $pa, $bol); } else { down_fire($pos, $range, $tab, $player, $pa, $bol); } } } }
} }*/ ?> <html> <head> <link href="style.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> </head> <body> <embed src="music.mp3" autostart="true" loop="true" hidden="true"></embed> <div id="content"> <div id="board"> <?php $i = 0; $j = 0; $grid = get_board(); /* if (isset($_POST['fire'])) $pos = take_pos(); else $pos = array(-1 , -1);*/ while ($i < 100) { $j = 0; while ($j < 150) { if (isset($grid[$i][$j][1])) { $rot = $grid[$i][$j][1]; } else { $rot = "0deg"; } if ($grid[$i][$j][0] === 12) { echo "<div id='carre'> <img id='bat_p1_middle' title='Blood Angels' style='-webkit-transform:rotate(" . $rot . ")' src='img/w/1.png'> </div>"; } else {