- modelData.sort of – comes with the symbol identity, e.grams. “rum”, “parrot”, “captain”, .
- modelData.regularity – holds brand new frequency value of the fresh new symbol.
- modelData.investigation – has the customized member studies of icon. We are able to utilize this to gain access to the picture provider setup away from all of our signs.
The one that fulfills the brand new slot machine game which have a backgbullet, a separate suggests light lines because the a boundary between your reels. That it visualize is placed over the history and the written symbols of the form the fresh new z assets.
Placing That which you To one another
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // complete games window having background Rectangle < // . > // incorporate video slot FlaskOfRumMachine < anchors.centerIn: parent defaultItemHeight: 80 // picture level 70 + 5 margin greatest + 5 margin base (Symbol.qml) defaultReelWidth: 67 // image width > // . > >
Even as we condition import “slotmachine” , we could are the component. I anchor it in the world and you can identify this fairgo new default thickness and you will peak with the activities and you will reels. While we failed to set a certain height for our signs, brand new standard viewpoints can be used for them. When you struck enjoy, it currently browse a little an effective. However, at the a closer look, new fixed level lets blank parts significantly more than otherwise underneath the position server.
Why don’t we correct that! And while we have been during the it, we can in addition to provide everything to life adding an excellent handler toward spinEnded laws and applying the fresh startSlotMachine() mode.
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // add casino slot games FlaskOfRumMachine < id: slotMachine // i heart it horzizontally and you can disperse they 10 px "under" the major pub // due to the fact image of the brand new bar casts a trace towards the towards the the fresh new casino slot games anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we require the new video slot to help you automobile-dimensions according to the readily available top // the brand new slotmachine use the video game screen peak with the exception of brand new topBar and you will bottomBar city // like with the big pub, the bottom club including casts a trace towards to help you slot machine height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // i after that assess the default goods level based on the genuine slotmachine peak and line amount defaultItemHeight: Math.round(slotMachine.height / rowCount) // and alter the reel thickness to match the item height (to maintain the fresh new depth/top ratio of the things that) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // velocity off twist will be drop off/raise together with items peak spinVelocity: Math.round(defaultItemHeight / 80 750) // link code in order to handler mode onSpinEnded: scene.spinEnded() > // . // start slot machine function startSlotMachine() < if(!slotMachine.rotating && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // treat athlete credit scene.creditAmount -= scene.betAmount // begin servers var stopInterval = utils.generateRandomValueBetween(500, 1000) // ranging from five-hundred and you may 1000 ms slotMachine.spin(stopInterval) > > // manage twist is gone rule function spinEnded() < bottomBar.startActive = not true if(bottomBar.autoActive) startSlotMachine() > > >
So we move new slot machine 10px right up so that the latest topbar as well as the slotmachine overlap a while
I start with aligning the whole casino slot games beneath the most useful pub. Although topbar image also incorporates a shadow at the bottom. Because finest club is put in addition position machine, they casts their shadow on it. An identical relates to the base bar. Only one in this case, the fresh peak of the casino slot games is set correctly to let it overlap with the bottom bar.
Immediately after function a working height into the video slot based on the fresh new offered area, we and determine this new width and you will level of one’s signs accordingly. And as the last step we including size the latest twist velocity in addition to the goods height. When we did not set an active way velocity, a video slot which have faster symbols seems shorter.
