April 2018
Beginner
714 pages
18h 21m
English
Most of the required preparations are done, and now it's time to make our game functional. The player should be able to make a move by clicking on a rod and then clicking on another rod. After the first rod is selected, the game should remember it and show it in a different color.
First, let's prepare the Rod component. We need it to have a new property that indicates that this rod was selected as the first rod for the next move:
property bool isSourceRod: false
It's easy to make the rod change color depending on the isSourceRod value using a property binding:
DiffuseSpecularMaterial { ambient: { if (isSourceRod) { return picker.containsMouse? "#f44" : "#f11"; } else { return picker.containsMouse? ...Read now
Unlock full access