Fixed the username text position, changed the username text color due to low visibility on sand - #16
Conversation
Fixed the position for the username text and cached the divisions.
| this.colour = Colours.get(-1, 111, shirtCol, faceCol); | ||
| fireRate = Small.FIRE_RATE; | ||
| // Perfectly matches the text over the head | ||
| nameOffset = (userName.length() / 2) * fontCharSize - ((userName.length() & 1) == 0 ? fontCharSize / 2 : 0); |
There was a problem hiding this comment.
Might consider splitting the equation from the ternary for readability.
There was a problem hiding this comment.
You are right about that, didn't observe its over 80 characters long.
| private int fireRate = 0; | ||
| // Need to add a class for constants | ||
| private int fontCharSize = 8; |
There was a problem hiding this comment.
Could probably be "final" :-)
DylanMeeus
commented
Feb 11, 2018
Overall good commit (code wise), didn't yet check it in the game itself though! |
I’ll take a look when I get home and pull this commit, thanks for the help!
Edit: Removed email reply |
redomar
commented
Feb 12, 2018
ThoughtsI agree it is difficult to see the name tag over the sandy areas, An excellent idea. Issue I foundThe code works only if you input a desired username, however if you blast through without typing a username it isnt aligned at all. Guest names are generated only when the username box is empty. My solutionHowever, I have a solution moving This line into this part. I'm guessing it is because it is after the 'temporary/guest' name has been made. What do you thinkDo you know why this is happening? Do you have another way to deal with this or are you going to try my solution, I'm open to opinions. |
ssarmis
commented
Feb 12, 2018
Yes, this is because the username initially is blank and gets modified on the go to be replaced with the "guest" one. |
ssarmis
commented
Feb 12, 2018
It looks a bit ugly (2 lines of code are repeating, could just use a function) + if the name is only 1 character long, its going to recalculate the offset again, but its perfectly aligned over the head. |
redomar
commented
Feb 12, 2018
Thanks for your time and effort |
ssarmis
commented
Feb 12, 2018
No problem, the pleasure is mine. |
redomar
commented
Feb 12, 2018
I messed up sorry, would you like to push the changes again, I overwritten the master directory when I was merging from previous work |
I've not used GitHub/Git in ages and I foolishly pushed a bad merge that was old, And 'reverting merge' opens a new pull request which I didn't know |
ssarmis
commented
Feb 13, 2018
I made another pr to be easier. |


Changed the name color due to low visibility on sand;
Fixed the position for the username text and cached the divisions.