• Content count

  • Joined

  • Last visited

About spinnerbox

  • Rank
    Advanced Member
  • Birthday 12/31/1986

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location
    Macedonia, Skopje
  • Interests
    Game desgin and development. My other R&D blog: http://tunephp.blogspot.com

Recent Profile Visitors

1,289 profile views
  1. Not sure if there is cleaner way to enable/disable keyboard input like for buttons, button.inputEnabled = false/true, but I created my own functions and used add/remove functions of the Phaser.Signal class: initKeyboard: function() { aKey = gameObject.input.keyboard.addKey(phaser.Keyboard.A); aKey.onDown.add(this.guess, answer1Btn); leftKey = gameObject.input.keyboard.addKey(phaser.Keyboard.LEFT); leftKey.onDown.add(this.guess, answer1Btn); uKey = gameObject.input.keyboard.addKey(phaser.Keyboard.U); uKey.onDown.add(this.updateFields, this); pKey = gameObject.input.keyboard.addKey(phaser.Keyboard.P); pKey.onDown.add(this.pauseUnpauseGame, this); oKey = gameObject.input.keyboard.addKey(phaser.Keyboard.O); oKey.onDown.add(this.saveData, this); spaceKey = gameObject.input.keyboard.addKey(phaser.Keyboard.SPACEBAR); spaceKey.onDown.add(this.submit, this); enterKey = gameObject.input.keyboard.addKey(phaser.Keyboard.ENTER); enterKey.onDown.add(this.submit, this); iKey = gameObject.input.keyboard.addKey(phaser.Keyboard.I); iKey.onDown.add(this.showResetWindow, this); }, disableKeys: function() { aKey.onDown.remove(this.guess, answer1Btn); leftKey.onDown.remove(this.guess, answer1Btn); spaceKey.onDown.remove(this.submit, this); enterKey.onDown.remove(this.submit, this); uKey.onDown.remove(this.updateFields, this); }, enableKeys: function() { aKey.onDown.add(this.guess, answer1Btn); leftKey.onDown.add(this.guess, answer1Btn); spaceKey.onDown.add(this.submit, this); enterKey.onDown.add(this.submit, this); uKey.onDown.add(this.updateFields, this); },
  2. In my main scene I add keyboard event listeners to specific keys in the init() state. Also some of those keys need to be disabled at specific time and re-enabled at specific time. How can I disable/enable input on specific keyboard buttons at runtime?
  3. I will be adopted by Chuck Norris Great, its fun! Maybe a health bar would look nicely when beating someone. You could also add achievements. But how do I pause it? Does Phaser pauses it when out of focus?
  4. Which one of these is Yoyo? http://sole.github.io/tween.js/examples/03_graphs.html
  5. I don't think tweens are designed to be fiddled like timers. It just starts and works until it reaches the end state. You can pause it but cannot reset it. Recreate the tween with same settings, to reset it from start, maybe? You could also play with timers and set properties of game objects with timers. But I don't know how Yoyo curve looks like Set a value for a game object property calculated by Yoyo function at a given time. Since it will be a timer, you can stop, pause, reset, loop...
  6. https://phaser.io/examples/v2/category/tweens https://phaser.io/examples/v2/tweens/pause-tween https://phaser.io/examples/v2/tweens/yoyo Also consult the Tween API You can add events onStart, onComplete, onRepeat, onLoop
  7. canvas is just a tag in the DOM. window is the parent element of all other elements in the DOM. You can draw fast graphics in canvas. You could also do some drawing with CSS and HTML, but the DOM is very slow. So there is the difference. That is why Phaser works in canvas, not in the DOM.
  8. The admob plugin loads something(ad image) or it just hangs? Explain more please. And by the way, admob is an Android plugin or you include it in javascript? Share some link, which plugin is that you use.
  9. Would really like to know Firebase, but I don't. The first thing you do when you use new technology is to read the docs: https://firebase.google.com/docs/web/setup https://firebase.google.com/docs/samples/#web
  10. JSON file is just a pile of data, no code there. localStorage is the web API that enables you to save data locally that will last after you close the browser. But it is easy to delete it, just call window.localStorage.clear(); You need JavaScript code and you include it in index.html <!DOCTYPE html> <html> <head> <title>Game Name</title> <meta charset="UTF-8" /> <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="description" content=""> <meta name="author" content="author"> <meta name="viewport" content="width=device-width, height=device-height, maximum-scale=1, initial-scale=1, user-scalable=no"> <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references --> <link rel="shortcut icon" href="assets/images/favicon.ico"> <link rel="apple-touch-icon" href="assets/images/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png"> <link rel="stylesheet" href="css/style.css"> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <style> body { margin: 0; padding: 0; } </style> </head> <body> <!-- libraries --> <script src="js/phaser.min.js"></script> <script src="js/jquery.min.js"></script> <!-- main file and utility --> <script src="js/MainFile.js"></script> <script src="js/utils/Utility.js"></script> <!-- constants --> <script src="js/Constants/Graphics.js"></script> <script src="js/Constants/GameMessages.js"></script> <script src="js/Constants/GameErrors.js"></script> <script src="js/Constants/Constants.js"></script> <script src="js/Constants/GameSettings.js"></script> <!-- data --> <script src="js/GameData/GameData.js"></script> <script src="js/GameData/OptionsData.js"></script> <!-- states --> <script src="js/States/State.js"></script> <script src="js/States/Boot.js"></script> <!-- UI --> <script src="js/UI/ArtmButton.js"></script> <script src="js/UI/GoToScreen.js"></script> <script src="js/UI/GoToUrl.js"></script> <!-- screens --> <script src="js/Screens/Screen.js"></script> <script src="js/Screens/Preloader.js"></script> <script src="js/Screens/MainMenuScreen.js"></script> <script src="js/Screens/StatsScreen.js"></script> <script src="js/Screens/OptionsScreen.js"></script> </body> </html> But this is while developing. You should have only one file, something like MainFile.min.js which will hold all other files, minified. You can use Nodejs, Grunt and Uglify to minimize the js file automatically.
  11. Don't use the "window" keyword, its reserved for the DOM of your web site/application. Name it somehing like "gameWindow". I also don't think dynamically generating keys in JavaScript object literal will work. The object does not exist yet at the time when you create your key. Unless this is ES6? Can you do this in ES6?
  12. I created my own template to enable separation of concerns, in different files. Check this GitHub project I use namespace() function to put all functionality under one DOM node, so it doesn't mix with other code in the DOM namespace. Therefore I have two files State.js and Screen.js. Boot inherits from State and all other screens(scenes) inherit from Screen. I also make utility classes like Utility.js where I put useful functions, so they don't mix with the other game logic or graphics code.
  13. Not sure what lopsided means. But if the thinner border on top and right is your problem, maybe you have gave Phaser wrong size parameters when importing the image asset that holds the square. Make sure the dimensions are pixel perfect and you know exactly where the image should be cut(blitted) by Phaser.
  14. When I load my main menu screen(Phaser.State) game.sound is already initialized. So in init() of MainMenuScreen I can now set game.sound.mute = true; //false But still a good to know fact. If somebody knows when exactly it gets created, please share.
  15. When the first Phaser.State gets created?