- modelData.method of – gets the symbol title, e.grams. “rum”, “parrot”, “captain”, .
- modelData.frequency – holds this new frequency property value the fresh icon.
- modelData.data – comes with the customized representative investigation of icon. We are able to make use of this to gain access to the image provider setting out-of the signs.
One which fulfills the latest slot machine having a back ground, a special reveals white lines just like the a boundary within reels. It visualize is put above the history and authored icons because of the setting the fresh z possessions.
Placing Everything you To each other
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . World < // . // fill video game windows having background Rectangle < // . > // add slot machine game FlaskOfRumMachine < anchors.centerIn: mother or father defaultItemHeight: 80 // picture level 70 + 5 margin best + 5 margin base (Symbol.qml) defaultReelWidth: 67 // image thickness > // . > >
As we condition transfer ” dream vegas casino slotmachine” , we can add the parts. We anchor they in the center of the view and you will specify the brand new default thickness and you will top towards the items and you will reels. As we don’t put a certain height for the signs, the default opinions can be used for all of them. When you strike gamble, that it currently lookup a bit an excellent. However, from the a closer look, the new fixed peak lets blank parts significantly more than otherwise underneath the slot servers.
Why don’t we correct that! And while the audience is within it, we could together with render everything you alive with the addition of a handler on twistEnded code and you may applying new startSlotMachine() means.
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // add casino slot games FlaskOfRumMachine < id: slotMachine // i center it horzizontally and you may move they ten px "under" the top bar // because the image of this new club casts a shade towards the into this new casino slot games anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we want new slot machine in order to vehicle-dimensions according to available peak // brand new slotmachine will use the overall game windows peak apart from the brand new topBar and you will bottomBar area // as with the big pub, the base pub including casts a trace into the to help you position host height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // i following calculate the latest standard goods peak in accordance with the actual slotmachine level and line count defaultItemHeight: Mathematics.round(slotMachine.height / rowCount) // and alter the fresh reel width to match the item level (to keep the brand new thickness/height ratio of the things that) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // acceleration out of spin is to drop off/boost and items peak spinVelocity: Math.round(defaultItemHeight / 80 750) // hook code so you're able to handler mode onSpinEnded: scene.spinEnded() > // . // begin video slot function startSlotMachine() < if(!slotMachine.spinning && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // beat athlete loans scene.creditAmount -= scene.betAmount // start machine var stopInterval = utils.generateRandomValueBetween(five-hundred, 1000) // ranging from 500 and you can 1000 ms slotMachine.spin(stopInterval) > > // handle spin is gone code function spinEnded() < bottomBar.startActive = false if(bottomBar.autoActive) startSlotMachine() > > >
Therefore we flow the brand new casino slot games 10px upwards to let the fresh topbar therefore the slotmachine convergence a bit
I start by aligning the entire slot machine underneath the better pub. But the topbar photo comes with a shade at the end. Given that ideal bar is placed in addition position servers, it casts its trace onto it. An equivalent applies to the beds base bar. Merely you to definitely in this case, the brand new level of your slot machine is determined properly to allow it overlap for the bottom pub.
Just after form an energetic peak to your slot machine based on the newest offered space, we plus estimate new width and you can level of your signs consequently. And also as the final move we in addition to size the fresh new spin acceleration along with the goods level. When we didn’t put a dynamic path velocity, a slot machine game that have smaller symbols seems quicker.