Hello there,
when you writing your first game you will notice that there is a really fancy play() method to play sounds.
However if you want to play a sound and stop it, you will have to add some more code. Here is an working example:
Sound winSound = getAssetLoader().loadSound("sound.wav")...
Here I would love to give some examples how the byType()-method is working. This method is from the JavaFX engine FXGL.
byType(EntityType)
With the byType method you can get a list of entities with the given type.
You can get the first element with
var firstEntity = byType(EntityType).get(0)...