| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 
 | function deplacer_heros(event:Event):void {
 
	if (ToucheGauche==true){
		action_heros=1;
		direction_heros=4;
		afficher_heros();
		if(decalage_fond_x==0){
			if(tester_cases_horizontales(-1)==true){
				fond.x+=vitesse_heros;
				monstres.x=fond.x;
				projectiles.x=fond.x;
				objets.x=fond.x;
				decalage_fond_x+=vitesse_heros;
				if(decalage_fond_x>31){
					deplacer_fond_droite();
					decalage_fond_x=0;
				}
			}
		}else{
			fond.x+=vitesse_heros;
			monstres.x=fond.x;
			projectiles.x=fond.x;
			objets.x=fond.x;
			decalage_fond_x+=vitesse_heros;
			if(decalage_fond_x>31){
				deplacer_fond_droite();
				decalage_fond_x=0;
			}
		}
	}else{
		if (ToucheDroit==true){
			action_heros=1;
			direction_heros=2;
			afficher_heros();
			if(decalage_fond_x==0){
				if(tester_cases_horizontales(1)==true){
					fond.x-=vitesse_heros;
					monstres.x=fond.x;
					projectiles.x=fond.x;
					objets.x=fond.x;
					decalage_fond_x-=vitesse_heros;
					if(decalage_fond_x<-31){
						deplacer_fond_gauche();
						decalage_fond_x=0;
					}
				}
			}else{
				fond.x-=vitesse_heros;
				monstres.x=fond.x;
				projectiles.x=fond.x;
				objets.x=fond.x;
				decalage_fond_x-=vitesse_heros;
				if(decalage_fond_x<-31){
					deplacer_fond_gauche();
					decalage_fond_x=0;
				}
			}
		}else{
			if (ToucheHaut==true){
				action_heros=1;
				direction_heros=1;
				afficher_heros();
				if(decalage_fond_y==0){
					if(tester_cases_verticales(-1)==true){
						fond.y+=vitesse_heros;
						monstres.y=fond.y;
						projectiles.y=fond.y;
						objets.y=fond.y;
						decalage_fond_y+=vitesse_heros;
						if(decalage_fond_y>31){
							deplacer_fond_bas();
							decalage_fond_y=0;
						}
					}
				}else{
					fond.y+=vitesse_heros;
					monstres.y=fond.y;
					projectiles.y=fond.y;
					objets.y=fond.y;
					decalage_fond_y+=vitesse_heros;
					if(decalage_fond_y>31){
						//trace(deplacer_fond_bas());
						deplacer_fond_bas();
						decalage_fond_y=0;
					}
				}
			}else{
				if (ToucheBas==true){
					action_heros=1;
					direction_heros=3;
					afficher_heros();
					if(decalage_fond_y==0){
						if(tester_cases_verticales(1)==true){
							fond.y-=vitesse_heros;
							monstres.y=fond.y;
							projectiles.y=fond.y;
							objets.y=fond.y;
							decalage_fond_y-=vitesse_heros;
							if(decalage_fond_y<-31){
								deplacer_fond_haut();
								decalage_fond_y=0;
							}
						}
					}else{
						fond.y-=vitesse_heros;
						monstres.y=fond.y;
						projectiles.y=fond.y;
						objets.y=fond.y;
						decalage_fond_y-=vitesse_heros;
						if(decalage_fond_y<-31){
							deplacer_fond_haut();
							decalage_fond_y=0;
						}
					}
				}else{
					if (ToucheEspace==true){
						action_heros=2;
						afficher_heros();
						interagir_heros();
					}else{
						if (ToucheX==true){
							action_heros=3;
							creer_projectile();
						}else{
							// aucune touche pressée
							action_heros=0;
							afficher_heros();
						}
					}
				}
			}
		}
	}
 
} | 
Partager