items/fromages: la princesse peut manger un fromage

En vrai, pour l'instant voilà ce qui est fait:

- le fromage existe et est plaçable sur le niveau à convenance. Autant
  qu'on veut.
- le fromage est une entité autonome dans ses animations et c'est lui
  qui va enoyer un signal à la princesse quand elle rentre en collision
  avec lui.

 Reste à mettre en place:
 - Un timer pour faire réaparaitre le fromage
 - Un affichager de jauge à prout pour la princesse
This commit is contained in:
Thomas Lavocat
2023-04-30 18:20:51 +02:00
parent 9fe8070e46
commit 66383d3659
7 changed files with 178 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
extends CharacterBody2D
class_name Princess extends CharacterBody2D
## The player listens for input actions appended with this suffix.[br]
## Used to separate controls for multiple players in splitscreen.
@@ -39,6 +39,7 @@ var gravity: int = ProjectSettings.get("physics/2d/default_gravity")
@export var WALK_INCR_GROUND : int = 1
@export var WALK_INCR_AIR : int = 3
signal cheese_collected()
################################################################################
#
@@ -348,21 +349,6 @@ func compute_state() -> void:
# gestion de l'état de la pression au mur
pressing_wall = not is_on_floor() and (wall_detect_left.is_colliding() or wall_detect_right.is_colliding())
func _physics_process(delta: float) -> void:
compute_state()
read_input()
velocity.y = jump()
velocity.y = fall()
velocity.x = walk(direction)
kick()
move_and_handle_collisions()
play_animation()
func get_new_animation() -> String:
# Renvoie la bonne annimation en fonction de l'état de la princesse
var animation_new: String
@@ -384,3 +370,16 @@ func get_new_animation() -> String:
else:
animation_new = "jumping"
return animation_new
func _physics_process(delta: float) -> void:
compute_state()
read_input()
velocity.y = jump()
velocity.y = fall()
velocity.x = walk(direction)
kick()
move_and_handle_collisions()
play_animation()
func reload_fart() -> void:
print("pouet")