- modelData.types of – comes with the symbol identity, e.grams. “rum”, “parrot”, “captain”, .
- modelData.regularity – keeps new regularity property value the fresh new icon.
- modelData.studies – contains the customized affiliate research of one’s symbol. We are able to utilize this to access the image provider configuration out-of the symbols.
The one that fills the fresh new slot machine game which have a back voodoo ground, a separate shows light outlines because an edge amongst the reels. It image is put above the history as well as the composed icons by mode the new z property.
Placing Everything Together
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // complete game windows that have record Rectangle < // . > // incorporate slot machine FlaskOfRumMachine < anchors.centerIn: father or mother defaultItemHeight: 80 // picture peak 70 + 5 margin most useful + 5 margin base (Icon.qml) defaultReelWidth: 67 // picture depth > // . > >
As we county transfer “slotmachine” , we are able to add the part. We point they in the exact middle of the world and you can identify the fresh new standard depth and you can level to your situations and you can reels. Once we didn’t lay a certain peak for the signs, the brand new default opinions are used for all of them. After you hit enjoy, which already search quite a beneficial. However, in the a closer look, the fixed top allows blank section above otherwise underneath the slot machine.
Let us correct that! And even though we’re from the they, we can including render what you alive adding a handler for the spinEnded code and implementing the fresh startSlotMachine() form.
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // incorporate slot machine FlaskOfRumMachine < id: slotMachine // we heart it horzizontally and move they ten px "under" the major pub // since the picture of the latest pub casts a shadow into for the new slot machine game anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we truly need the latest slot machine to auto-size depending on the readily available height // the newest slotmachine use the game screen top except for the brand new topBar and bottomBar area // just as in the top bar, the bottom pub together with casts a shadow on the to help you position host height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // i then determine the new default items peak based on the actual slotmachine level and you can line matter defaultItemHeight: Mathematics.round(slotMachine.height / rowCount) // and alter new reel depth to fit the item level (in order to maintain the newest thickness/peak ratio of the things that) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // speed off spin is always to drop off/raise as well as goods level spinVelocity: Math.round(defaultItemHeight / 80 750) // hook signal so you're able to handler setting onSpinEnded: scene.spinEnded() > // . // begin slot machine function startSlotMachine() < if(!slotMachine.rotating && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // cure member loans scene.creditAmount -= scene.betAmount // begin machine var stopInterval = utils.generateRandomValueBetween(five-hundred, 1000) // between five-hundred and you can 1000 ms slotMachine.spin(stopInterval) > > // manage spin is fully gone rule function spinEnded() < bottomBar.startActive = false if(bottomBar.autoActive) startSlotMachine() > > >
So we move brand new slot machine 10px upwards to allow new topbar and the slotmachine convergence some time
We begin by straightening the complete slot machine game below the greatest club. Nevertheless topbar photo also contains a shadow in the bottom. While the finest club is placed in addition slot machine, they casts its shadow on it. The same relates to the beds base club. Merely one to in this case, the latest height of the slot machine game is decided appropriately so that it convergence for the base bar.
Shortly after mode an active level toward video slot predicated on the latest available space, i plus determine the brand new width and you can top of your signs accordingly. And as the final move i and level brand new spin speed plus the item top. If we don’t put a working way acceleration, a slot machine having quicker signs would appear faster.
