| 35 | |
| 36 | } |
| 37 | function create(){ |
| 38 | console.log("Create"); |
| 39 | |
| 40 | //buttons |
| 41 | // <button onclick="spinwheel()">Click me</button> |
| 42 | // this.load.onClick('spinwheel();'); |
| 43 | |
| 44 | //create the background image |
| 45 | let W = game.config.width; |
| 46 | let H = game.config.height; |
| 47 | |
| 48 | let background = this.add.sprite(0,0,'background'); |
| 49 | background.setPosition(W/2,H/2); |
| 50 | background.setScale(0.16); |
| 51 | |
| 52 | //lets create the stand |
| 53 | let stand = this.add.sprite(W/2,H/2,'stand'); |
| 54 | stand.setScale(1); |
| 55 | |
| 56 | |
| 57 | //lets create a pin |
| 58 | let pin = this.add.sprite(W/2,H/2,"pin"); |
| 59 | pin.setScale(1); |
| 60 | pin.depth = 1; |
| 61 | |
| 62 | //let create wheel |
| 63 | this.wheel = this.add.sprite(W/2,H/2,"wheel"); |
| 64 | this.wheel.setScale(0.215); |
| 65 | //this.wheel.alpha = 0.5; |
| 66 | |
| 67 | |
| 68 | |
| 69 | // the game has just started = we can spin the wheel |
| 70 | this.canSpin = true; |
| 71 | |
| 72 | //event listener for mouse click |
| 73 | this.input.on("pointerdown",spinwheel,this); |
| 74 | |
| 75 | //lets create text object |
| 76 | font_style = { |
| 77 | font : "bold 30px Arial", |
| 78 | align : "center", |
| 79 | color : "red", |
| 80 | } |
| 81 | this.game_text = this.add.text(50,750,"!!CLICK TO SPIN & GET LUCKY NUMBER!!",font_style); |
| 82 | |
| 83 | |
| 84 | |
| 85 | } |
| 86 | document.addEventListener('DOMContentLoaded', function(){ |
| 87 | var script = document.createElement('script'); |
| 88 | script.src = 'https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js'; |