Following design and you may subcontract meanings, i include a couple photos

  • modelData.sorts of – comes with the icon title, e.grams. “rum”, “parrot”, “captain”, .
  • modelData.frequency – keeps the brand new regularity worth of the new symbol.
  • modelData.investigation – has got the custom affiliate study of your icon. We could use this to gain access to the picture resource configuration out-of our very own symbols.

One which fills this new video slot that have a backgbullet, another type of suggests light lines just like the a boundary within reels. It image is put above the records and created symbols because of the mode the fresh z possessions.

Putting That which you To one another

import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . World < // . // fill game window that have record Rectangle < // . > // put slot machine game FlaskOfRumMachine < anchors.centerIn: moms and dad defaultItemHeight: 80 // image level 70 + 5 margin better + 5 margin base (Symbol.qml) defaultReelWidth: 67 // picture thickness > // . > >

After we county import “slotmachine” , we can add the part. I anchor it in the world and you can indicate betfred the newest standard depth and you may level on the points and you can reels. While we did not lay a particular height for our signs, the brand new default thinking are used for them. When you hit enjoy, that it already research quite a beneficial. But at a closer look, the fresh new fixed level allows empty elements above or below the position server.

Let us correct that! And even though we have been at it, we can and render that which you alive by the addition of an effective handler for the twistEnded rule and you can applying the fresh startSlotMachine() setting.

import Felgo 4.0 import QtQuick 2.0 import "slotmachine" GameWindow < // . Scene < // . // create slot machine game FlaskOfRumMachine < id: slotMachine // we cardiovascular system they horzizontally and you can move it ten px "under" the top bar // because the picture of the fresh new club casts a trace into the on the new video slot anchors.horizontalCenter: scene.horizontalCenter anchors: topBar.bottom anchors.topMargin: -10 // we are in need of the latest slot machine game to vehicles-proportions depending on the offered top // the new slotmachine uses the game window peak apart from the brand new topBar and you will bottomBar city // just as in the top pub, the beds base pub together with casts a trace towards in order to slot machine height: scene.gameWindowAnchorItem.height - (topBar.+ anchors.topMargin) - (bottomBar.height 10) // i following estimate the new standard goods level according to research by the genuine slotmachine level and you can row amount defaultItemHeight: Mathematics.round(slotMachine.height / rowCount) // and change the newest reel thickness to match the thing top (to keep up the fresh new thickness/height proportion of the items) defaultReelWidth: Math.round(defaultItemHeight / 80 67) // velocity regarding twist would be to fall off/boost also product top spinVelocity: Math.round(defaultItemHeight / 80 750) // hook code so you're able to handler setting onSpinEnded: scene.spinEnded() > // . // start casino slot games function startSlotMachine() < if(!slotMachine.spinning && scene.creditAmount scene.betAmount) < bottomBar.startActive = true // treat player credit scene.creditAmount -= scene.betAmount // start server var stopInterval = utils.generateRandomValueBetween(five hundred, 1000) // between five hundred and you may 1000 ms slotMachine.spin(stopInterval) > > // handle twist is finished code function spinEnded() < bottomBar.startActive = untrue if(bottomBar.autoActive) startSlotMachine() > > >

Therefore we circulate the fresh new video slot 10px right up to let brand new topbar and slotmachine overlap a while

I start with straightening the whole slot machine below the top bar. Nevertheless topbar picture also incorporates a shadow in the bottom. As the most readily useful pub is placed in addition position server, it casts its trace about it. An equivalent applies to the bottom pub. Only that in cases like this, the new top of the slot machine game is decided properly to let it overlap with the bottom pub.

After means a working top into the video slot based on brand new offered place, i and additionally assess this new width and you may height of signs appropriately. And also as the final action i and size the latest twist acceleration and the product peak. When we did not set a working movement speed, a slot machine that have faster signs would appear shorter.