We are trying to make frogger like game in JavaFX. We have classes such as player,car and log. The problem is that we are drawing our player directly on the canvas using gc.drawImage(), and the car/log objects are added to pane (we are using pathtransition to animate the logs). This is causing the player to end up underneath the log object. Is there anyway to get the player to end up on top the log? When the player intersects with the log, we want it to be placed on top of the log and follow it.
Related
This is a rare bug, but sometimes when I start my Qt app the qt3d window which hosts my scene is blank (without any of my models), except the window itself seems to be bugged because it will mirror other parts of the GUI if I shift between tabs. So instead of my scene appearing in the window it'll contain information and widgets from another tab that's located in the same area as the window on a different tab.
This doesn't occur very often, which makes the bug hard to replicate. Has anyone else seen this behavior before or maybe it's the way I'm setting up the Qt3DExtras::Qt3DWindow?
Qt3DExtras::Qt3DWindow* view = new Qt3DExtras::Qt3DWindow();
view->defaultFrameGraph()->setClearColor(QColor(0,0,0));
view->setRootEntity(CreateScene());
// embed 3D Window in Widget
QWidget* container = QWidget::createWindowContainer(view);
ui->verticalLayout_visualizer->addWidget(container);
We are in great need of assistance:
When we move the player from our scene into the VR: Google Store GUI (Desert scene)
No matter how we rotate or reset the position of the player before the desert loads, the message box (with confirm button) ALWAYS spawn behind the player.
This forces the player to always rotate around 180 to interact with the confirm button.
We are out of ideas...
Greatful for any help!
Thanks.
I am using the new unity networking using unity 5.3.1 , my player prefab is a UI canvas , so when another client joins the canvas's overlap and I cannot press any button on host or client .
What i want is to disable other canvase's on each players game and just leave the local players canvase active , I have tried islocalplayer , isclient ,isserver but nothing works .
Is there a way around this please do tell.
Here are some options I can think of:
1) Instead of making canvas a player object, make panel a player object, so that all your players are different panels under same canvas. Now, when object are under same canvas, they ray casting order is determined by the order in hierarchy.
The objects that are lower in the hierarchy occlude those that are higher. So, what you can do is moving your player object to the lowest position in objects hierarchy, so that it will occlude all other players. This can be done using Transform methods SetSiblingIndex and GetSiblingIndex, like
transform.SetSiblingIndex(100000/*some big number*/);
2) Disable raycasting on all other players - what if you can click some component on canvas or not is whether it is a raycast target. Images and Text components can be raycast targets, or more generally any component that inherits from Graphics. You can iterate over all components of type Graphics in all players except the local player and mark raycastTarget = false.
I figured it out and as #NikaKasradze said use only one canvas and put all gui listeners in the islocalplayer bool check .
When I open a page of my application in the browser, I can see the debug toolbar at the bottom of the page. When I click on the timeline, however, the data is shown in a canvas.
I'm blind, and thus can't interact with a canvas through my screen reader. I'm wondering if there's a way to view the timeline data, without having it drawn on a canvas?
I stuck at this stage, how add that 3 towers in to the StackPane and how to move the bricks inside that pane (from 1-2-3 for example) using only JavaFX code without Scene Builder? I would be grateful for any answers!
Image:
My suggestion:
You create a class "Tower" which extends the class Pane and contains a list of disks. The class has a method "accept" which returns boolean depending on whether you can put a disk there or not.
Create 3 instances of the class Tower.
Then you create a class "Disk" which extends the class Rectangle. Create 8 instances with varying width and add them to the first tower, ie the list of the class Tower.
Each Disk will use a mouselistener as described in Drag nodes like in a patience/Klondike card game. The mechanism is very similar to what you need.
In the mousepressed handler of the mouse listener you check whether the disk is on top of the tower or not and hence whether you can drag it or not.
In the mousereleased handler of the mouse listener you simply check whether a disk intersects (see boundsInParent and intersects) with a given tower. If it does and the accept method returns true, you drop it there. If the accept method returns false, you let it fly back to where it came from.
You're finished when a Tower has all of the disks.
That's basically it.
Oh, and don't use a StackPane, use a Pane instead. And you don't need images. The picture you show can be created solely of rectangles.