- modelData.types of – has got the icon name, age.grams. “rum”, “parrot”, “captain”, .
- modelData.volume – keeps this new volume property value the brand new symbol.
- modelData.analysis – provides the personalized user data of your icon. We could use this to get into the image resource arrangement regarding all of our signs.
One that fulfills the newest slot machine game with a back ground, a different suggests light outlines as a line between your reels. This image is put above the history as well as the composed icons because of the mode the z property.
Putting Everything you To one another
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . World < // . // fill games windows that have history Rectangle < // . > // create casino slot games FlaskOfRumMachine < anchors.centerIn: mother defaultItemHeight: 80 // photo level 70 + 5 margin greatest + 5 margin base (Icon.qml) defaultReelWidth: 67 // picture width > // . > >
After we state import “slotmachine” , we can are the parts. We point they in the exact middle of the world and establish the fresh standard width and peak into the items and you may reels. While we failed to put a particular peak for our symbols, the standard beliefs are used for them. When you strike play, so it already search some an effective. However, from the a closer look, the latest repaired level lets blank areas a lot more than or underneath the position servers.
Let us genuine that! And clover bingo while we have been on they, we are able to as well as provide everything to life adding a great handler on spinEnded laws and you will applying new startSlotMachine() setting.
import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // put slot machine game FlaskOfRumMachine < id: slotMachine // i cardio it horzizontally and you will flow it ten px "under" the top pub // due to the fact picture of the pub casts a trace into the on the newest slot machine anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we want the new video slot to auto-proportions according to the offered top // brand new slotmachine use the online game windows peak with the exception of the brand new topBar and you can bottomBar town // like with the top pub, the bottom bar and casts a shadow into to help you slot server height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // we then determine the new standard item top in accordance with the real slotmachine top and you may line number defaultItemHeight: Mathematics.round(slotMachine.height / rowCount) // and alter the latest reel depth to complement the thing top (in order to maintain new thickness/top proportion of the things that) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // velocity out-of twist would be to disappear/boost along with item height spinVelocity: Math.round(defaultItemHeight / 80 750) // link signal so you're able to handler function onSpinEnded: scene.spinEnded() > // . // initiate video slot function startSlotMachine() < if(!slotMachine.spinning && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // beat member loans scene.creditAmount -= scene.betAmount // start host var stopInterval = utils.generateRandomValueBetween(five hundred, 1000) // anywhere between 500 and you can 1000 ms slotMachine.spin(stopInterval) > > // handle twist is fully gone signal function spinEnded() < bottomBar.startActive = false if(bottomBar.autoActive) startSlotMachine() > > >
So we circulate the newest slot machine game 10px upwards so that the brand new topbar together with slotmachine convergence some time
We begin by straightening the whole slot machine below the greatest club. But the topbar image also incorporates a shadow in the bottom. Because the most readily useful club is put in addition slot machine, it casts their shadow on it. A similar applies to the bottom pub. Simply that in this instance, the level of the slot machine is determined properly so that it convergence into bottom pub.
After mode an energetic peak for the slot machine game based on new available place, i also calculate brand new thickness and you will level of your own icons properly. And as the last move i along with scale new twist acceleration along with the product level. If we failed to lay an active course velocity, a slot machine game which have reduced symbols would seem less.
