princesse/état: copie de l'état entre niveaux
La princesse récupère son état d'un niveau à l'autre. De cette manière, on ne perd pas les fromages.
This commit is contained in:
		
							
								
								
									
										4
									
								
								game.gd
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								game.gd
									
									
									
									
									
								
							| @@ -21,7 +21,9 @@ func enter_door(destination : String, other_side_position : Vector2): | ||||
|     call_deferred("go_to", destination, other_side_position) | ||||
|  | ||||
| func go_to(destination : String, spawn_point): | ||||
|     var old_princesse :Princess | ||||
|     if current_scence: | ||||
|         old_princesse = current_scence.find_child("Princesse") | ||||
|         remove_child(current_scence) | ||||
|  | ||||
|     if destination == "level_1": | ||||
| @@ -42,3 +44,5 @@ func go_to(destination : String, spawn_point): | ||||
|         var princesse :Princess = current_scence.find_child("Princesse") | ||||
|         princesse.position = spawn_point | ||||
|         last_spawn_point = spawn_point | ||||
|         if old_princesse: | ||||
|             princesse.copy_from(old_princesse) | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										31
									
								
								princesse.gd
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								princesse.gd
									
									
									
									
									
								
							| @@ -43,6 +43,8 @@ var DASH_SPEED = WALKING_SPEED * 2 | ||||
| @export var WALK_INCR_GROUND : int = 1 | ||||
| @export var WALK_INCR_AIR : int = 3 | ||||
|  | ||||
| @export var MAX_FARTS : int = 1 | ||||
|  | ||||
| signal cheese_collected() | ||||
| signal princesse_is_dead() | ||||
|  | ||||
| @@ -92,9 +94,34 @@ var dashing : bool = false | ||||
| var dash_step : int = -1 | ||||
| var dash_direction_x : int = 1 | ||||
| var dash_direction_y : int = 1 | ||||
|  | ||||
| var available_dashs = 0 | ||||
| @export var MAX_FARTS : int = 1 | ||||
|  | ||||
| func copy_from(other : Princess): | ||||
|     direction = other.direction | ||||
|     walking = other.walking | ||||
|     walking_step = other.walking_step | ||||
|     walk_incr_reserve = other.walk_incr_reserve | ||||
|     init_decel = other.init_decel | ||||
|     init_direction_change = other.init_direction_change | ||||
|     jumping = other.jumping | ||||
|     need_jump = other.need_jump | ||||
|     jumping_step = other.jumping_step | ||||
|     jump_key_counter = other.jump_key_counter | ||||
|     kicking = other.kicking | ||||
|     kick_step = other.kick_step | ||||
|     kick_direction = other.kick_direction | ||||
|     coyote_ground = other.coyote_ground | ||||
|     coyote_grab = other.coyote_grab | ||||
|     falling_step = other.falling_step | ||||
|     pressing_wall_left = other.pressing_wall_left | ||||
|     pressing_wall_right = other.pressing_wall_right | ||||
|     pressing_wall = other.pressing_wall | ||||
|     grab_wall = other.grab_wall | ||||
|     dashing = other.dashing | ||||
|     dash_step = other.dash_step | ||||
|     dash_direction_x = other.dash_direction_x | ||||
|     dash_direction_y = other.dash_direction_y | ||||
|     available_dashs = other.available_dashs | ||||
|  | ||||
| ################################################################################ | ||||
| # | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Thomas Lavocat
					Thomas Lavocat