mike Vigor

Ranch Hand
+ Follow
since Jun 04, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mike Vigor

Knute Snortum wrote:I don't know if that is possible.  The two GUIs need to interact?  If it's a login to a server, maybe test the login first, then launch the second GUI.  Maybe the first GUI talks to the second through a socket.

I think I need to know your use case.  Normally, to log into a server, then use that connection, you would use the model I showed you.  Why do you need to launch a program, login, then go back to launching program to continue?

because the game in itself communicates to a server via rmi, so SetUp is just a controller in the middle, it gets values from the gui, then calles remote objects methods and sends data, when it gets return values or messages from the server, then it fires a gui passing the results from server as parameters, something like that...I hope you get the idea...

I know it can be  done, I just haven't figured how...
4 years ago
@Knute Snortum
Thanks but this is not my problem, I will love to see a snippet on how to call the gui multiple times from another class with a void main, like this for an example using your JavaFxPlay class...
4 years ago

Knute Snortum wrote:In general, you don't launch several applications in JavaFX, but you can use several stages.  Stages can be hidden or shown as needed.

So in your case, I would launch the a main GUI but not show the stage.  Then create a second stage that is the login window and show it.  Once the user has successfully logged on, hide the login stage and show the main stage.

ok, can you post a code snippet to launch a stage from outside the gui class? in my example from one of the SetUp class methods? a very short example of launching a first stage and closing it, and launching another one..all in another class's main or method..
4 years ago
So I'm working on a javafx simple game project which involves communicating with a server through rmi.
Data for setup will be obtain from the user through a javafx gui which will be closed and opened multiple times depending on how the setup goes.
The javafx gui's are called from the SetUp class which does not extend application itself.
After setup is complete the main game gui(javafx) will be loaded..

Assuming we have two gui's, LoginGui and OptionGui to call in that order..

Problem: call to LoginGui is successful with

Successive calls to OptionGui was not working so I was told to place the line before stage.show () in the first gui class which starts the Application process
and then in my SetUp class after the first gui which is called with "Application.launch(gui.class)" closes, other gui classes can be called with this code example

but the program just jumps this lines of code and continues without showing the OptionGui, can someone pinpoint me the correct way to do this? thanks in advance
4 years ago

Knute Snortum wrote:I pasted the classes into an IDE and ran the Main class, but I'm not sure what I'm seeing or what I'm supposed to see.  I'm assuming P1 and P2 are player one and two, and I can move them by dragging them to adjacent sectors, but I don't know what the problem is.  Sometimes  the piece moves where I drag it and sometime not, but I don't see any pattern to it.

I think you need to explain what the desired output is and what the problem is.

Thank you for trying to help...if you watch the pieces, they should always be in a sector, so in the example you have in the ide, moving a piece into a sector, that sector Id or sector name should be printed on the console, but if you look on the console, the sector name being printed on the console is different from the sector in which the piece finds itself and every sector has its name written on it in the gui so you can see with your eyes, AND INFACT, you notice sometimes the pieces dont move into the sectors, and sometimes the pieces move into empty spaces, ALL THESE should not be happening...and I'm asking if someone can help me solve this...
5 years ago
I really do think unless one loads all the classes in an ide and actually runs this code, one may not understand the problem/error i'm talking about by just looking with his/her eyes..
so please just do that thanks
5 years ago
So I'm working on a game which has to mimic a space ship with aliens and humans on board and the humans have to escape from the aliens and the aliens have to try to eat the humans. Aliens and humans players get to move around the space ship my means of a piece with their player numbers written on it!
The space ship is made up of cells, called sectors, which I did build with a hexagon, every sector has a name and a coordinate and if a player moves into another cell/sector it's present cell/sector should be updated.
For a reason or so it seems there is a rearrangement of the coordinates of the cells/sectors after a player moves...this error is soo difficult to explain so I did create a miniature project of the original one with every minimal feature necessary to mimic perfectly the original one and I'm going to posts all the classes here so that any one who wants to help me solve the situation can can load it and build it and try it and see the problem I'm talking about...unfortunately I think this is the only way I can really get help solving the problem
so here are the classes..
the problem/error I'm having is made clear on line 104 in the piece class where there is some printing to console to make it clear that the coordinates/nodes id being printed to the console is very different from that being seen in the gui /screen




//FERMI spaceship class






5 years ago
problem solved! I solve the whole thing using the java fx concurrent package found here

5 years ago

Paul Clapham wrote:It's normal in most GUI systems that, if you cause the GUI's thread to sleep, that blocks the whole GUI. I don't know specifically about Java FX but I can tell you that's how it works in Swing.

So you're going to have to recast your code so that it works according to the way that GUI's want to work. You already have a requirement which says something like "When the user clicks on X then such and such should start happening"; that suggests that you should have a listener attached to X which tells you when the user clicks there. When that happens, your code should cause that other stuff to start happening.

I think this is the solution, creating a listener..so if something is clicked...something happens..if something is moved..something happens..if not nothing happens...this will really solve it...thanks Paul Clapham..I was seeking the lazy way out with that while loop.. ;)
5 years ago
by pressing a botton in hbox the method void gaming() is called..so it does not start straight away after building the space ship..
I want to sleep because I have to force the player to move. That is how the game works, is it played in turns for 39 round..so if is the turn of a player, till the player moves his piece the game must WAIT/SLEEP..
I have a lable because in certain conditions I can break the whole loop and end the game...PlayerCharacter.ALIEN is an enumeration...
damn it campbell Ritchie...you focusing on all the things which are not why I posted and never talked once about the problem I asked...I'm the one designing the game so I know what I have to do, I know...I'm having a particular problem..talk about that ...
5 years ago
I will try
I have a space ship made of cells called sectors from my class Sector which I designed with  Shape Polygon.
I placed my ship in a Group I called tileGroup.
I have a class player which creates number of players after asking user to input number of players...
I have a Piece class which creates a circular piece using Shape Circle for each player..a player can be an alien or a human, all pieces are placed in the tileGroup, which will be set in the center of a BorderPane...
I have a game class which will control the players playing the game, through it's method void gaming()..
at the top of the BorderPane there is an hbox containing rectangle shapes which will in certain conditions will take mouse inputs... //lol is getting complicated eh...

then I create content and pass is to Stage and I show like this

running this everything goes fine and the app shows up and the game is ready to be played..

OK..so the game must be played in a series of rounds..TO TRACK the movement of a player piece, class piece has a field called count and when a player moves a piece with the mouse, count must be increased...

so this is a bit more detailed to give a more clearer idea..hopes someone can explain why this situation happens...meanwhile I'm gonna try to implement that point in a different way..
5 years ago

Norm Radder wrote:

need the player to move an object on the screen before the games continues

Normally that is done by the program letting the JVM do the waiting until a user created event.  When the player moves, that creates an event the JVM will pass to a listener in the code where the the game can continue.
Do not use calls to sleep to do any waiting on user actions.

I am not familiar with JavaFX so can not recommend techniques to use there.

this is quite strange, I just want all other objects executing other functions to continue to do their thing, like the one playing the game music, that must not stop...but the function/thread where the while loop is should stop...
soo strange..I'm at a loss...
5 years ago
ok so I'm working on a game application and I need the player to move an object on the screen before the games continues if not the game should just sit there forever...but using a while loop like so

upon arriving at this point the game freezes and I get the mouse rotating on end thing on the windows machine I'm using and I see something like "program not responding"

so changing it to this and handling exceptions ...

I get the same result

I just need the function to pause right there till getCount() value get increased...
5 years ago
no help from anybody?
5 years ago