- modelData.style of – comes with the symbol name, e.grams. “rum”, “parrot”, “captain”, .
- modelData.regularity – retains the brand new volume value of the fresh new icon.
- modelData.data – comes with the custom affiliate data of one’s icon. We can make use of this to gain access to the picture supply configuration away from all of our symbols.
The one that fulfills brand new casino slot games with a background, an alternative reveals white contours due to the fact a boundary amongst the reels. That it picture is positioned above the records while the written symbols from the setting the z property.
Placing Everything To one another
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . World < // . // complete game screen having background Rectangle < // . > // include slot machine FlaskOfRumMachine < anchors.centerIn: mother or father defaultItemHeight: 80 // visualize top 70 + 5 margin better + 5 margin base (Icon.qml) defaultReelWidth: 67 // visualize depth > // . > >
Even as we county transfer “slotmachine” , we are able to range from the parts. I anchor trust dice they in the center of the view and you can specify the brand new default thickness and top to your factors and reels. As we failed to lay a specific height for our signs, the brand new default philosophy can be used for all of them. When you hit enjoy, which already look somewhat good. But at a close look, the fresh repaired level lets blank elements over otherwise underneath the slot server.
Let us correct that! Even though our company is at the they, we can as well as render everything to life by adding a handler towards the twistEnded signal and you will applying new startSlotMachine() form.
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // incorporate video slot FlaskOfRumMachine < id: slotMachine // i cardio it horzizontally and you can flow they ten px "under" the big pub // because the image of this new pub casts a trace to your into the fresh new casino slot games anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we require brand new slot machine game in order to auto-size with respect to the available peak // the fresh slotmachine use the video game window peak with the exception of the topBar and bottomBar area // as with the major pub, the bottom club along with casts a shadow to the to position server height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // we next determine new standard item level according to the actual slotmachine top and you can line matter defaultItemHeight: Math.round(slotMachine.height / rowCount) // and change the brand new reel thickness to fit the item peak (to steadfastly keep up brand new depth/peak proportion of the things that) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // velocity away from spin should decrease/raise in addition to product peak spinVelocity: Math.round(defaultItemHeight / 80 750) // connect code so you're able to handler function onSpinEnded: scene.spinEnded() > // . // initiate slot machine function startSlotMachine() < if(!slotMachine.rotating && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // lose member credits scene.creditAmount -= scene.betAmount // initiate server var stopInterval = utils.generateRandomValueBetween(five hundred, 1000) // between five hundred and 1000 ms slotMachine.spin(stopInterval) > > // handle twist is finished signal function spinEnded() < bottomBar.startActive = not true if(bottomBar.autoActive) startSlotMachine() > > >
So we move the newest video slot 10px upwards so that the new topbar additionally the slotmachine overlap some time
I start by straightening the complete casino slot games below the top club. However the topbar picture also contains a trace towards the bottom. Since the most readily useful pub is put on top of the position server, it casts the trace onto it. An equivalent relates to the bottom club. Simply one in such a case, this new peak of your casino slot games is decided accordingly so that it convergence into the bottom bar.
Immediately after setting a dynamic peak towards the video slot centered on this new available place, i as well as estimate the depth and height of the symbols properly. So when the past action i also measure the fresh new twist acceleration also the product level. When we don’t place a working way acceleration, a video slot having faster signs seems faster.
