ProjectLam / learn_music_game

Learn heritage instruments with an interactive game with a real instrument
1 stars 2 forks source link

Instrument selection rework. #36

Closed darthLeviN closed 1 year ago

darthLeviN commented 1 year ago

Performance instrument selection logic and ui has been reworked. now we can use the InstrumentData resource type to describe an instrument and it's properties.

In PlayerVariables singleton the gameplay_instrument_data and gameplay_instrument_name properties can be used to set and retrieve the current InstrumentData and intrument identifier.

Player.cfg will now record the preferred performance instrument in the [gameplay] section with the variable selected_instrument_name. E.g. selected_instrument_name="guitar".

A small bugfix was also added to the user score viewer.

darthLeviN commented 1 year ago

A better way to handle unique instrument identification is to use the file name of the InstrumentData resource rather than an additional variable (so the piano identifier would become "piano.tres"). File names are guaranteed to be unique because all files are in the same folder and operating systems don't allow files with duplicate names. This subsequently means you can simplify some of this code.

I turned the insturment_name into a property that returns the file name of the resource so that if we want to change the logic in the future we only change that.