Formation par Olivier Duffez

Formation au référencement par Olivier Duffez, créateur de WebRankInfo !
Une formule efficace alliant théorie et pratique, avec une haute disponibilité des intervenants
Cette formule a déjà convaincu plusieurs centaines d'entreprises, pourquoi pas vous ?
Réservez vite votre place en ligne (convention possible pour imputer sur le budget formation)

Formation référencement Marseille

Une map php pour rpg

Poster un nouveau sujet Imprimer cette discussion    Forum -> Développement d'un site Web   Les dernières discussions de ce forum sont disponibles au format RSS
Voir le sujet précédent :: Voir le sujet suivant  
Auteur Message
sff
WRInaute occasionnel
WRInaute occasionnel

Inscrit le: 03 Fév 2005
Messages: 162

URL permanente de ce messagePosté le : Dim Déc 31, 2006 13:57    Sujet du message: Une map php pour rpg

J'ai crée dernièrement une map (carte) pour un rpg en php, mais je l'a trouve beaucoup trop lourde lors des déplacement. C'est surement a cause de la lourdeur des while.

Pouvez vous me dire comment je peux procéder?

Code:
<?php

  function exploration($infosperso, $queryonline, $controlrow) { // Exploration
 
  $barre_hp = $infosperso['currenthp'] / $infosperso['maxhp'] * 130;
  $barre_tp = $infosperso['currenttp'] / $infosperso['maxtp'] * 130;
  $barre_mp = $infosperso['currentmp'] / $infosperso['maxmp'] * 130;   
   
  $page ='<div><img src="images/jeu/actions/exploration.jpg" width="580" height="82" alt="En exploration"/><br /><br /></div>';

  $page .='
  <form enctype="multipart/form-data" action="?page=deplacement" method="post">
  <div style="background-image: url(images/carte/b1.gif); background-position: bottom; background-repeat: no-repeat; width:576px; height:9px"></div> 
 
  <div style="position:absolute; background-image: url(images/carte/haut1.gif); height:17px; width:570px; background-position:right top; background-repeat: no-repeat; text-align:right"><div style="float:right; width:156px; text-align:center"><span class="rose3"><b>Long:</b></span> '.$infosperso['longitude'].' - <span class="rose3"><b>Lat:</b></span> '.$infosperso['latitude'].'</div></div>
  <div style="position:absolute; padding-left:14px; padding-top:3px"><span style="color:#ffffff"><b>HP</b></span></div><div style="position:absolute; width:130px; padding-left:14px; text-align:right"><span style="color:#ffffff"><b><span style="font-size: 14px;">'.$infosperso['currenthp'].'</span> /'.$infosperso['maxhp'].'</b></span><br /><div style="background-image: url(images/carte/barre-rose.png); width:130px; height:4px; text-align:left"><img src="images/carte/barre-bleu.png" width="'.$barre_hp.'" height="4" alt="" style="display:block"></div></div>
  <div style="position:absolute; padding-left:14px; padding-top:23px"><span style="color:#ffffff"><b>MP</b></span></div><div style="position:absolute; width:130px; padding-left:14px; padding-top:20px; text-align:right"><span style="color:#ffffff"><b><span style="font-size: 14px;">'.$infosperso['currentmp'].'</span> /'.$infosperso['maxmp'].'</b></span><br /><div style="background-image: url(images/carte/barre-rose.png); width:130px; height:4px; text-align:left"><img src="images/carte/barre-verte.png" width="'.$barre_mp.'" height="4" alt="" style="display:block"></div></div>
  <div style="position:absolute; padding-left:14px; padding-top:43px"><span style="color:#ffffff"><b>TP</b></span></div><div style="position:absolute; width:130px; padding-left:14px; padding-top:40px; text-align:right"><span style="color:#ffffff"><b><span style="font-size: 14px;">'.$infosperso['currenttp'].'</span> /'.$infosperso['maxtp'].'</b></span><br /><div style="background-image: url(images/carte/barre-rose.png); width:130px; height:4px; text-align:left"><img src="images/carte/barre-rouge2.png" width="'.$barre_tp.'" height="4" alt="" style="display:block"></div></div> 
  <div style="position:absolute; z-index:1; display:block; background-position:bottom; background-image: url(images/carte/nav.gif); height:368px; width:88px; background-repeat: no-repeat"><div style="width:77px; padding-top:310px; text-align:center"><input name="north" type="image" title="Aller en haut" class="no_bordure"  src="images/carte/bouton-haut.gif"/><br /><input name="west" type="image" title="Aller à gauche" class="no_bordure" src="images/carte/bouton-gauche.gif"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="east" type="image" title="Aller à droite" class="no_bordure" src="images/carte/bouton-droite.gif"/><br /><input name="south" type="image" title="Aller en bas" class="no_bordure" src="images/carte/bouton-bas.gif"/></div></div>

  <div style="background-image: url(images/carte/b3.gif); padding:0px; width:576px;">';

  $latmax = $infosperso['latitude'] + 3;
  $longmax = $infosperso['longitude'] + 5;
  $latmin = $infosperso['latitude'] - 3;
  $longmin = $infosperso['longitude'] - 5;

  $latitude = $latmax;

  $page .='<table style="background-image: url(images/carte/herbe.gif); width:558px; cellspacing:0px; cellpadding:0px; margin-left:9px">';
   
while ($latitude >= $latmin ) {

  $page .='<tr>';

$longitude = $longmin;

while ($longitude <= $longmax) {

$elements_sql = doquery("SELECT nom FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "carte");
$elements = mysql_fetch_array($elements_sql);

$villes_sql = doquery("SELECT name FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
$villes = mysql_fetch_array($villes_sql);

$joueurs_sql = doquery("SELECT avatar, charname, currenthp, maxhp, onlinetime FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "users");
$joueurs = mysql_fetch_array($joueurs_sql);

if(($joueurs['avatar'] !='')&& ((strtotime($joueurs['onlinetime']) >= time()-600))){

$barre_rouge = $joueurs['currenthp'] / $joueurs['maxhp'] * 49;

$page .='<td><div style="text-align:center; vertical-align:top;"><img src="images/avatars/carte/'.$joueurs['avatar'].'.gif" alt=""><br /><div style="background-color:#000000; height:3px; text-align:left"><img src="images/carte/barre-rouge.png" width="'.$barre_rouge.'" height="3" alt="" style="display:block"></div></div><div style="position:absolute; width:49px; text-align:center"><span style="font-size: 8px; color:#ffffff"><b>'.stripslashes($joueurs['charname']).'</b></span></div></td>';
}elseif($villes !=''){
$page .='<td><div style="text-align:center; vertical-align:top;"><img src="images/carte/ville.gif" alt="" style="display:block"></div><div style="position:absolute; width:49px; text-align:center"><span style="font-size: 8px; color:#D40078; background-color:#EDDDFF"><b>'.stripslashes($villes['name']).'</b></span></div></td>';
}elseif($elements !=''){
$page .='<td style="background-image:url(images/carte/'.$elements['nom'].'.gif); width:49px; height:49px; background-repeat: no-repeat;"></td>';
}else {
$page .='<td style="width:49px; height:49px;"></td>';
}

$longitude++;
}
$page .='</tr>';
$latitude--;
}
$page .='</table>';
 
  $page .='</div>
 
  <div style="background-image: url(images/carte/b2.gif); background-repeat: no-repeat; width:576px; height:9px"></div></form><br><br>   
  </form>
  ';
 
  echo $page;
 } 

?>



 
sff Visiter le site web du posteur
 
Montrer les messages depuis:   
Revenir en haut    Forum -> Développement d'un site Web Toutes les heures sont au format GMT + 2 Heures
Page 1 sur 1 - 
Connexion
Nom d'utilisateur:    Mot de passe:      Se connecter automatiquement à chaque visite    

Définitions :

CLIQUEZ ICI pour vous inscrire à WebRankInfo (forum, annuaire, outils...)

Connexion

© 2001-2005 phpBB Group, support français
Personnalisation : WebRankInfo ™


 ODP  Firefox  Alsacreations  annuaire webmaster Yagoort