This sprint I worked on #205 which is changing the name of the avatar on stage. This is very challenging. I started to work on the main UI, adding the input box and button to the view of the stage. After adding the input box for the avatar name and the edit button, I started to add the function of the input field and the button. The input field and the edit button should be disabled initially when the player clicks on an avatar then the button and the input field should be enabled to allow the user to input the new name of the avatar. When the player clicks on the button then the name should change according to the input field.
Ran into some problem while implementing the button function. When the button is pressed nothing is changing, the name is still the same. I initially stored the names of the avatar as a variable but later on realized that it will change all the name of the avatar to the same one if you hold more than one avatar. I then changed it so that it saves it to an array according to their avatar id. When the player holds an avatar, it checks if there is a name assigned to it, if not then the name of the avatar will be the original one, if there is then the name would be taken and printed on the canvas.
After testing out the new code there is another problem when the first avatars name is changed and the player holds another, the input field does not change, it will have the previous changed name for the first avatar, it meant to have changed to the when the player holds an avatar. I tested the code again and it didn’t seem to work, it doesn’t execute the edit function. Spent a long time trying to find out why the function is not executing. Realised it was one of the other function that I didn’t implement. Changed some implementation and both input box changes name when switching avatar and edit button.