Roulette Wheel App
Posted By admin On 09/04/22SilverSprings Software. Roulette is one of the oldest and most popular casino games in the world. It is also one of the simplest to play. In Roulette you place your bet on a number, row, line, or adjacent numbers. After bets are placed, the Roulette wheel is spun and the ball is dropped. First, to set up a new wheel: Scroll down to the 'Edit wheel'section. In the text box, you can edit the words or names that are displayed on the wheel. Simply select and remove everything and put your own entries in it. Each entry should be on a new line or separated by a comma. Click on the 'Update' button. Edit & Spin wheel in App. Create your own fortune wheels. Grab the FREE app and create your own wheels of fortune for your raffles, random draws, fun decisions and all the other cool stuff you come up with! Spin The Wheel - Random Picker App. Top Spin The Wheel App features.
We are presenting a mobile game by rotating a roulette wheel using jQuery. The core library is jQueryRotate.js used to create an example for demonstration. Apart from core library, topics about building an Cordova APP will be discussed here.
All codes here are not complicated, so you can easily understand even though you are still students in school. To benefit your learning, we will provide you download link to a zip file thus you can get all source codes for future usage.
EXPLORE THIS ARTICLE
TABLE OF CONTENTS
BONUS
SOURCE CODE DOWNLOAD
We have released it under the MIT license, so feel free to use it in your own project or your school homework.
Download Guideline
- Prepare HTTP server such as XAMPP or WAMP in your windows environment.
- Download and unzip into a folder that http server can access.
SECTION 1
CORDOVA JQUERY ROULETTE
How to rotate an image in Cordova APPs. Truly, it is similar to that in browser. Completely tested HTML and JavaScript codes in browser on developing mode can be moved to Cordova APPs directly.
jQueryRotate Library
We introduce an example created by a jQuery extension called jQueryRotate.js, and convert it into a Cordova APP. This example is a Roulette Wheel game. Our previous post has talked about it in details and written about where the jQueryRotate.js library come from.
Using jQuery Mobile
To build a Cordova APP from HTML and JavaScript, you had better add the jQuery Mobile project to make it be responsive in web design. We leverage jQuery Mobile Pages here to embed whole Roulette Wheel game into pages.
Roulette Wheel Of Luck
Don’t Use CDN in Cordova
We consider compatibility and choose jQuery Mobile 1.4.5 and jQuery 1.11.1 together, but don’t use CDN in Cordova APPs. Just download it in advance.
Build a Cordova APP
Cordova CLI command lines can fulfill the building process from creating to final building. For arguments in creating, the roulette is PATH, com.easycodeshare.roulette is ID, and Roulette is human readable NAME.
Replace content of the folder roulette/www with all downloaded source codes, and then issue the final command to build an APP.
If not familiar with how to build a Cordova APP, refer to 3 Steps Cordova Build APPs from jQuery Mobile.
SECTION 2
JQUERYROTATE.JS EXAMPLE
jQueryRotate.js consists of basic 3 methods, rotate(), getRotateAngle(), and StopRotate(). Roulette example will lead you to understand it.
The Basics
Below the a JavaScript object method function roul.rotate()
in this roulette example. It calls $('#turntable').rotate()
by jQuery to start rotating based on jQueryRotate.js library.
For the meanings of angle
, animateTo
, and duration
, refer to the previous post about roulette, how to rotate a roulette picture on click using jQuery.
Roulette Wheel Layout
Clicking on the roulette wheel forces it to turn for a while. When stopped, upper pointer indicate gained prize which is also shown on a text field.
Getting Prizes
JavaScript object prize
calculates a randomly generated prize for each rotating. There are 37 slots, and each slot has a corresponding prize in mapping
.
Stop Roulette Wheel
Stopping is an optional action. Of course, you can suddenly stop it. At that time, it will show a random angle, rather than a prize.
FINAL
CONCLUSION
This post extends our previous post to make the roulette wheel game more funny by putting it into mobile phones.
Thank you for reading, and we have suggested more helpful articles here. If you want to share anything, please feel free to comment below. Good luck and happy coding!
Learning Tips
Let us suggest a excellent way to learn HTML scripts here. Using Google ChromeF12 Inspect or Inspect Element will help you study the codes.
In Google Chrome, there are two ways to inspect a web page using the browser built-in Chrome DevTools:
- Right-click an element on the page or in a blank area, then select Inspect.
- Go to the Chrome menu, then select More Tools > Developer Tools.
Suggested Reading
- How Javascript Take a Picture in Cordova APPs
- Solving Cordova Android 9 Clear Text Not Permitted
TRY IT
QUICK EXPERIENCE
That is all for this project, and here is the link that let you experience the program. Please kindly leave your comments for our enhancement.
Roulette Wheel App Android
Try It Yourself
Click here to execute the source code, thus before studying the downloaded codes, you can check whether it is worthy.
How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.