Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The last successfull hit doesn't update the board color #32

Open
Sokom141 opened this issue Nov 11, 2020 · 17 comments · Fixed by #39
Open

The last successfull hit doesn't update the board color #32

Sokom141 opened this issue Nov 11, 2020 · 17 comments · Fixed by #39
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Sokom141
Copy link
Owner

Right before winning the game, if the last ShipUnit is hitted the background color of the clicked button doesn't change to the color set to indicate an hit.

@Sokom141 Sokom141 added the bug Something isn't working label Nov 11, 2020
@Sokom141 Sokom141 added this to the 1.0 milestone Nov 11, 2020
@Sokom141 Sokom141 changed the title The last successfull hit doesn't update the board color. The last successfull hit doesn't update the board color Nov 11, 2020
@sstanham
Copy link

Hi again! I can try to tackle this bug.

@Sokom141
Copy link
Owner Author

Hi @sstanham!
Good, I'm going to assign this issue to you, as always let me know if you need anything 😄

@sstanham
Copy link

Sorry for the delay, I will be working on this issue throughout the next few days.

@Sokom141
Copy link
Owner Author

No worries, take the time you need

@sstanham
Copy link

sstanham commented Dec 4, 2020

Hi again, sorry for the delay, I'm working on the bug as we speak. I'm looking through the files and I'm trying to find where the code stops if all the ships are destroyed, or runs again if both players have ships remaining. Would this be in the GUI folder?

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 7, 2020

Hi @sstanham, sorry for the late replay but University is getting harder 😭

You will find the code that need the fix inside the GameBoard.java file, this class handles a lot of things about the game (and for this should be broken down in more classes and refactored).
The method affected by the bug should be handleData if I'm not mistaken.
That method in the future will also for sure need to be refactored and extracted in another class for easier access to the protocol, but for now you can modify that.
Let me know if you need anything, have fun 😄

@sstanham
Copy link

sstanham commented Dec 8, 2020

Don't worry @Sokom141, I'm with you there on the University grind 😄

I will take a look at the section you believe is the culprit today, but I also have another question; Are you able to walk me through how to play an entire game on the same device? Or is it only possible via LAN and the internet for now?

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 8, 2020

Hey @sstanham !
Actually you can use any of these methods to play a game.

On the same device:
Just run two indipendent processes of the game, the one hosting it should choose a port ( I suggest something higher than ~1000 ) and wait for the client.
The client should then input the localhost IP (127.0.0.1) and the port previously chosen.
That should be enough to start the game on the same machine.

Over LAN/Internet the flow is pretty much the same, just need for the client to input the right local or remote IP and for the server to open the port / create a rule on the firewall if necessary.

Let me know if you're able to play!

@sstanham
Copy link

sstanham commented Dec 8, 2020

Running the code locally returns a "Connection Closed" error, I'm running with a port of 10000. Any suggestions?

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 8, 2020

Just to make sure, are you running the latest development branch?

@sstanham
Copy link

sstanham commented Dec 8, 2020

I believe so, allow me to redownload the branch

@sstanham
Copy link

sstanham commented Dec 8, 2020

Yes, the error occurs on the latest branch. On a side note, for the issue at hand, does the last successful hit not update the color for the winner, the loser, or both players?

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 8, 2020

If I'm not mistaken for the winner.

As for the error please make sure in the application settings you have a user avatar, without one the game won't be able to start

@sstanham
Copy link

sstanham commented Dec 8, 2020

Ok, I got it to work! Furthermore, I have identified that for the losing player, they are fine. For the winner, it's the fact that it turns the incorrect color. I'll see what I can do😄

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 8, 2020

Good news, thank you!

@sstanham
Copy link

sstanham commented Dec 8, 2020

#39 Just submitted a pull request! How I solved it is in the description, feel free to check it out

Edit: I seem to be encountering an issue linking the pull request to this issue. Could you help me with that?

@Sokom141
Copy link
Owner Author

Sokom141 commented Dec 8, 2020

Good! I will now review it.
As for the link, on my end, I see the PR fine with the syntax #39

@Sokom141 Sokom141 linked a pull request Dec 8, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants