Ajoute Instrument + jouer melodie
This commit is contained in:
parent
5b26e074e4
commit
4ba84426d6
16 changed files with 207 additions and 29 deletions
8
Instrument/Corde.gd
Normal file
8
Instrument/Corde.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Instrument
|
||||
class_name Corde
|
||||
|
||||
func _init(nom : String) -> void:
|
||||
super(nom)
|
||||
|
||||
func pincer() -> void:
|
||||
print("On pince l'instrument %s." % nom)
|
19
Instrument/Flute.gd
Normal file
19
Instrument/Flute.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends Vent
|
||||
|
||||
var Balle = preload("res://scenes/Attaque/Balle.tscn").instantiate() # Charger le nœud Balle
|
||||
|
||||
func _init() -> void:
|
||||
super("Flûte")
|
||||
|
||||
func jouer_melodie(player_position) -> void:
|
||||
print("La flûte joue une mélodie.")
|
||||
jouer()
|
||||
spawn_balle(player_position)
|
||||
|
||||
|
||||
func spawn_balle(player_position) -> void:
|
||||
# Assurez-vous que vous ajoutez la balle comme enfant dans une scène appropriée
|
||||
if Balle:
|
||||
Balle.position = player_position # Place la balle à la position actuelle du joueur
|
||||
else:
|
||||
print("Erreur : la création de la balle a échoué.")
|
9
Instrument/Instrument.gd
Normal file
9
Instrument/Instrument.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
class_name Instrument
|
||||
|
||||
var nom : String
|
||||
|
||||
func _init(nom : String) -> void:
|
||||
self.nom = nom
|
||||
|
||||
func jouer() -> void:
|
||||
print("L'instrument %s est joué." % nom)
|
9
Instrument/Percusson.gd
Normal file
9
Instrument/Percusson.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Instrument
|
||||
class_name Percussion
|
||||
|
||||
|
||||
func _init(nom : String) -> void:
|
||||
super(nom)
|
||||
|
||||
func frapper() -> void:
|
||||
print("On frappe l'instrument %s." % nom)
|
8
Instrument/Tambour.gd
Normal file
8
Instrument/Tambour.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Percussion
|
||||
|
||||
func _init() -> void:
|
||||
super("Tambour")
|
||||
|
||||
func faire_roulement() -> void:
|
||||
print("Le tambour fait un roulement.")
|
||||
jouer()
|
8
Instrument/Vent.gd
Normal file
8
Instrument/Vent.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Instrument
|
||||
class_name Vent
|
||||
|
||||
func _init(nom : String) -> void:
|
||||
super(nom)
|
||||
|
||||
func souffler() -> void:
|
||||
print("On souffle dans l'instrument %s." % nom)
|
Loading…
Add table
Add a link
Reference in a new issue