Jump to content

Search the Community

Showing results for tags 'slickui'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi everyone. I'm creating a game with Phaser for a University project and I'm trying to use Flaxis'plugin slick-ui in my project (https://github.com/Flaxis/slick-ui). I'm struggling since hours trying to get it to work. I initialized the variable slickUI, containing the plugin SlickUI, like this (following the code of a preview posted by Flaxis). In my script in index.html: window.onload = function(){ var game = new Phaser.Game(960, 640, Phaser.CANVAS,'', { preload: preload}); //adding slickUI plugin var slickUI; function preload() { slickUI = game.plugins.add(Phaser.Plugin.SlickUI); slickUI.load('assets/kenney/kenney.json'); //directory where I put kenney.json } //... } As I run this code I get no error in the console log. I thought that var slickUI, exactly as var game, was a global variable so I could be able to use it in any other .js file, but I guess I'm wrong. I tried to use slickUI variable in a file called MainMenu.js file (which is a game state, that is called after Boot.js and Preloader.js), to create a panel to be visible. My code is this: Game.MainMenu = function(game) //crea uno stato di Game { }; //prototype Game.MainMenu.prototype = { create:function(game){ var panel; slickUI.add(panel = new SlickUI.Element.Panel(8, 8, 150, game.height - 16)); //these two lines I took from the example on github }, //... } But when I try to use the variable I instantiated in the index file, that is slickUI, I get the error on console log that variable "slickUI is not defined". I tried to define and use that variable as "this.slickUI", "game.slickUI", "this.game.slickUI" but none of these worked. I also tried to instantiate the plugin directly in the MainMenu.js, but it didn't work either. So, my question is: how do I get to instantiate/call the global variable slickUI which contains the plugin, in order to be able to use it in every other .js file in the project? Your help would be so appreciated.
×
×
  • Create New...