pebb

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. There's a good talk on introduction to use websockets with node and phaser here. And the code from the talk is here: https://github.com/fullstackio/ng-game/tree/master/client/src/scripts It doesn't talk about social authentication though. I know that Django + python-socialauth + django-channels supports websockets and social authentication but not sure how comfortable you are with django.
  2. Thanks, flow. I think I will end up using PhysicsEditor along with this code: function create() { var graphics = game.add.graphics(0, 0); graphics.beginFill(0xFFFFFF); graphics.name='illinois'; graphics.drawPolygon([ 0+20,0 , 40+20,0 , 40+20,40 , 0+20,40 ]); graphics2.alpha=10; graphics.inputEnabled = true; graphics.input.useHandCursor = true; graphics.events.onInputUp.add(onClick, this); } function onClick(target, pointer) { console.log(target.name); }
  3. Hi. I would like to make a geography quiz game. The player should be able to click on a map to identify a certain state in the U.S. I read about using making polygon shapes for sprites (using PhysicsEditor), but how do I make mutiple polygons that are super-imposed on a map (image) which will trigger a callback that can I customize? Any free tools and/or tutorials that I use to accomplish this? Thanks.
  4. I got it working. I had to override the keyListener function. function myListener(evt) { this.value = this.getFormattedText(this.domElement.value); // 13 is enter if (evt.keyCode === 13) { console.log("Your text: " + this.value); this.resetText(); this.endFocus(); this.startFocus(); return; } this.updateText(); this.updateCursor(); this.updateSelection(); evt.preventDefault(); }; function create() { input1 = game.add.inputField(10, 150, { font: '18px Arial', fill: '#212121', fontWeight: 'bold', width: 150, padding: 8, borderWidth: 1, borderColor: '#000', borderRadius: 6, placeHolder: 'Type and press enter', type: PhaserInput.InputType.text, focusOutOnEnter: true, blockInput: true }); input1.startFocus(); input1.keyListener = myListener; }
  5. Ok, I was able to get it to recognize a press ENTER event, but after I enter input I am not able to refocus on the input to type some more. I want to automatically clear the input and refocus on it so I can type more text. Here's the code: function sayHello(event) { //event.preventDefault(); if (event.keyCode === 13) { console.log('you pressed enter!'); console.log("your text:" + input1.value); input1.setText(''); input1.endFocus(); input1.startFocus(); } } function create() { var sprite = game.add.sprite(0, 0, 'dude'); input1 = game.add.inputField(10, 150, { font: '18px Arial', fill: '#212121', fontWeight: 'bold', width: 150, padding: 8, borderWidth: 1, borderColor: '#000', borderRadius: 6, placeHolder: 'Type and press enter', type: PhaserInput.InputType.text, focusOutOnEnter: true, blockInput: true }); input1.startFocus(); input1.domElement.element.addEventListener('keydown', sayHello.bind(game)); } Here's the sandbox: http://phaser.io/sandbox/edit/SWiOEouu
  6. I'm using PhaserInput plugin[1] to make an input box, but when I hit ENTER it doesn't call my function. Here's the code in my `create()` function input1 = game.add.inputField(10, 150, { font: '18px Arial', fill: '#212121', fontWeight: 'bold', width: 150, padding: 8, borderWidth: 1, borderColor: '#000', borderRadius: 6, placeHolder: 'Type and press enter', type: PhaserInput.InputType.text, focusOutOnEnter: false, blockInput: false }); input1.startFocus(); enterKey = game.input.keyboard.addKey(Phaser.Keyboard.ENTER); enterKey.onDown.add(sayHello, game); Also, here's the sandbox : http://phaser.io/sandbox/edit/UZDMKRKt [1] https://github.com/orange-games/phaser-input