JavaFX Game: Battleship

Поделиться
HTML-код
  • Опубликовано: 24 окт 2024

Комментарии • 35

  • @waldorojas569
    @waldorojas569 6 лет назад +3

    is it possible to display an enemy's shot a few milliseconds later after the player's shot has been displayed? i tried it with calling Thread.sleep(1000) inside the enemyMove()-Method before calling cell.shoot(). But then i realized that the UI doesn't get updated in realtime so both shots will be displayed still simultaneously but with a delay of 1 sec after each click.

  • @ishtihaqtalukder6992
    @ishtihaqtalukder6992 3 года назад +1

    hoping for a reply. probably wont happen though. Thanks for this really helps teach me the basic of game design better than my university. Anyway my question is do i need to download javafx separately for this or do i install it from eclipse?

    • @roybagati9288
      @roybagati9288 3 года назад

      You might have found a solution for this already...but i think it depends on the JDK you're using. 11 to latest you will need to download javafx separately.

  • @CelestialDuck
    @CelestialDuck 5 лет назад +3

    I cant get the cells to work is there anything you recommend?

    • @ivanbabuder3096
      @ivanbabuder3096 4 года назад +1

      he has class cell in board.java, so in your BattleshipMain.java you need to - import ( your name of the folder )Board.Cell;
      ~ line 15
      it should work just fine

  • @Kat-mw9ln
    @Kat-mw9ln 6 лет назад +1

    Thank you very much

  • @norrismwiinga4145
    @norrismwiinga4145 8 лет назад

    Hi am trying to create a similar game, although the only difference is that it is a two player game.. help!! please!!

  • @akenoxd5423
    @akenoxd5423 3 года назад

    How do I add custom ships. For example, I want the length of ship1 to be 5, ship2 to be 4 and ship3 and ship4 to be 3 and finally ship 5 to be 4.

  • @reshaadrahim6317
    @reshaadrahim6317 9 лет назад

    hey man great video! But is it possible to just do a 2 player game and take out the AI? and also randomize each players ships position each turn?How would you do this?

    • @AlmasB0
      @AlmasB0  9 лет назад +1

      +RESHAAD RAHIM Hi, I'm assuming you mean 2 players as in a 2 player game over network, as I don't quite see how 2 players can play on the same machine. Here's a must read before getting into networking: docs.oracle.com/javase/tutorial/networking/datagrams/
      Regarding your 2nd question, suppose you have a method that places a ship at given position. After each turn, for each surviving ship, compute a random value for X and Y and call that method to place the ship.

    • @reshaadrahim6317
      @reshaadrahim6317 9 лет назад

      +Almas Baimagambetov (AlmasB) sorry ,i meant repositioning the ship's shape....randomly repositioning the ship's shape at the start of every game.For example you have vertical and horizontal shapes as your ships...but you want them instead to be the shape of an S or L .

    • @hendrixj.8356
      @hendrixj.8356 8 лет назад +1

      Before networked games you actually had to get up and change seats with the other player. Oh the good ol' days... It's more or less on the honor system that the other player wont look over your shoulder at your ship placement. A screen could pop up before each turn saying player x's turn.

  • @Kat-mw9ln
    @Kat-mw9ln 6 лет назад +1

    It really help me

  • @RaulBillieJean
    @RaulBillieJean 9 лет назад +1

    Nice video!
    Thanks

  • @JohnSmith-rh6sw
    @JohnSmith-rh6sw 9 лет назад +1

    Nice Definition.
    Keep it up!! :)

  • @ibrahimjamil2774
    @ibrahimjamil2774 6 лет назад +1

    Hi Almas, is there a way we can make this template the same however on a TCP connection? So having 1 computer vs another?
    Please let me know, I would really appreciate your help.
    Thank you

    • @AlmasB0
      @AlmasB0  6 лет назад +2

      Hi, please see ruclips.net/video/VVUuo9VO2II/видео.html to get your server-client connection sorted. After that, it's just a matter of checking which player it is, i.e. if player1 do something, if player2 do something else.

    • @ibrahimjamil2774
      @ibrahimjamil2774 6 лет назад

      Almas Baimagambetov thank you.

    • @aybarsali3232
      @aybarsali3232 2 года назад

      @@_.rin._504 Did you? And if you did it, please contact me.

  • @juhichecker9206
    @juhichecker9206 7 лет назад

    can you send the link of the right side bar controls?

  • @lucascerha
    @lucascerha 7 лет назад

    What do we do if we want to ad more boats? Let's say 1 more 2 cell boat?

    • @akenoxd5423
      @akenoxd5423 3 года назад

      I need help with that too

  • @evanebdo2070
    @evanebdo2070 2 года назад

    This is program doesn't follow the MVC structure, from what i have understood

  • @norazmihb7626
    @norazmihb7626 9 лет назад

    how you code work?
    even i copy cant aces

  • @Alex11Fox
    @Alex11Fox 5 лет назад +1

    А Call of Duty будет?

  • @TheBaGro
    @TheBaGro 6 лет назад +2

    I have done the AI version of this, using your idea. Hope that you are gonna like it. github.com/bkrunic/Battleships-AI

    • @AlmasB0
      @AlmasB0  6 лет назад +3

      Hi, that's great that the tutorial inspired you to extend it and build something new. I am glad that it was useful.

    • @TheBaGro
      @TheBaGro 6 лет назад

      @@AlmasB0 Thank you for your anwser. Have you tried to defeat it?

  • @raphaelsouza8697
    @raphaelsouza8697 2 года назад +1

    very small code, hard to see and follow. use common sense and put this in a readable size!

  • @nijatmursali9943
    @nijatmursali9943 9 лет назад +1

    you haven't give information about library that you have included Parent Class and others. tutorial is good but not good enough.

    • @AlmasB0
      @AlmasB0  9 лет назад

      +Nicat Murseliyev Hi, I appreciate your feedback. The name of the library is JavaFX, which is mentioned in the title and video description. I would like to point out that JavaFX is not a 3rd party library per se. As the things currently stand, it is the recommended Java GUI toolkit, as well as part of the Java Runtime Environment.

    • @nijatmursali9943
      @nijatmursali9943 9 лет назад +2

      +Almas Baimagambetov (AlmasB) i didn't mean exacly Libraries. You could give more information about other Classes like Parent Rectangle so on.

    • @AlmasB0
      @AlmasB0  9 лет назад +1

      Ah, I see. Yes, will definitely consider this in the future. Many thanks