Jump to content

Search the Community

Showing results for tags 'coffeescript'.

  • 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 5 results

  1. Hey all, I'm trying to get Phaser, Coffeescript, and Node-Webkit all running together. In running just the very basic Getting Started "Hello, world" example here: http://phaser.io/tutorials/getting-started/part6 It works just fine as-is within NW, but when I try and write it in Coffeescript per the following: window.onload = -> test = new Phaser.Game(800, 600, Phaser.AUTO, '', {preload: preload, create: create}) preload = -> test.load.image('logo', 'assets/images/phaser.png') create = -> logo = test.add.sprite(test.world.centerX, test.world.centerY, 'logo') logo.anchor.setTo(0.5, 0.5)it compiles to the following JavaScript: // Generated by CoffeeScript 1.6.3(function() { window.onload = function() { var create, preload, game; game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create }); preload = function() { return game.load.image('logo', 'assets/images/phaser.png'); }; create = function() { var logo; logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo'); return logo.anchor.setTo(0.5, 0.5); }; };}).call(this);and then I get the following error: [8063:0903/115650:INFO:CONSOLE(30716)] ""Invalid Phaser State object given. Must contain at least a one of the required functions: preload, create, update or render"", source: file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js (30716)[8063:0903/115650:INFO:CONSOLE(38762)] ""%c %c %c Phaser v2.4.3 | Pixi.js v2.2.8 | WebGL | WebAudio %c %c %c http://phaser.io %c\u2665%c\u2665%c\u2665" "background: #9854d8" "background: #6c2ca7" "color: #ffffff; background: #450f78;" "background: #6c2ca7" "background: #9854d8" "background: #ffffff" "color: #ff2424; background: #fff" "color: #ff2424; background: #fff" "color: #ff2424; background: #fff"", source: file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js (38762)[8063:0903/115650:ERROR:nw_shell.cc(336)] TypeError: Cannot set property 'game' of undefined at Phaser.StateManager.link (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:30739:31) at Phaser.StateManager.setCurrentState (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:30805:14) at Phaser.StateManager.preUpdate (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:30611:18) at Phaser.Game.updateLogic (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:39002:24) at Phaser.Game.update (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:38893:18) at Phaser.RequestAnimationFrame.updateRAF (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:61958:19) at _onLoop (file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js:61942:30)[8063:0903/115650:INFO:CONSOLE(30739)] "Uncaught TypeError: Cannot set property 'game' of undefined", source: file:///Users/coltonoscopy/Desktop/everdungeon/js/phaser.js (30739)I'm unsure as to what exactly is going on, as the JS seems to be identical in functionality, if not structured slightly differently thanks to CoffeeScript's compiler. Any help is appreciated. Thank you very much! Best, Colton
  2. In my game, i have a timer event which will run for 60 seconds. This is a startGame function in coffeescript. Which has a time event in bold letters. I passed @seconds_counter value which is 60. So this timer will count till 60 seconds and afterthat calls @removeCounter function. startGame: -> left_button = @add.button(60, 350, 'button', @checkAnswerForLeft, this) right_button = @add.button(460, 350, 'button', @checkAnswerForRight, this) @time.events.remove @timer # Start main game counter @seconds_timer = @time.events.loop(Phaser.Timer.SECOND, @updateSecondsCounter, this) @time.events.add Phaser.Timer.SECOND * @seconds_counter, @removeCounter, this In my game i want to give users a time bonus in which i want to add extra seconds to this time event. I added 10 seconds to @seconds_counter but it won't affect this timer event. So in short, my game loop is 60 seconds. If user get time bonus then add 10 seconds to game loop so for that user gae will be of 70 seconds and after that @removeCounter function should call. Is there any way to update time for running timer??
  3. Hi, Caveat: I'm new to Phaser, new to CoffeeScript, and fairly new (< 6 months) to Javascript. I've written a small-ish game in JS + CraftyJS in the past. I'm trying to convert the "hello world" Phaser app into its equivalent in CoffeeScript. Here's what I have working: class State constructor: () -> preload: () -> game.load.image('logo', 'phaser.png') create: () -> logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo') logo.anchor.setTo(0.5, 0.5)window.onload = () -> @game = new Phaser.Game(800, 600, Phaser.AUTO, '', new State)I've looked at the equivalent generated JS, but I can't quite figure out why this works; specifically, @game = new Phaser.Game(...) confuses me. TLDR: why do I need to assign the value to @game and not just game? Observations: window.game takes the value of the game variableThe State class has no references to game, or window, that I can seeChanging @game to game breaks the game. Can anyone explain this? It doesn't seem like it has to do with closures, or global variables, or anything else I can think of. Why does this work?
  4. Hello, I am a coffeescript dev, who love pair programming and coding dojo. (i come from the "web startup app" side of the force I want to practice by skype, hangout, (vim+tmux) whatever... in pair programing. The main idea is exploring Phaser. I propose a exercice on a particular topic, we practice 1,2 hours. Then you do the same proposing a topic that you know. The only one restriction is : No javascript ! Coffeescript only, (at least livescript but i am not so strong with). If you have a strong skill on phaser and you want something more from me, i can share my skill on 'ruby on rails' or angularJs.
  5. Hey everyone, inspired by Nokdu's post about Phaser with Meteor integration I decided to whip up my own little project skeleton and host it on Github. Here's a quick little FAQ: Q: Does it run on Windows too? A: Yes! Even though Meteorite is not supported under windows, you can emulate it's behavior. Instructions to do so are found in my README. With it, both Windows and *nix users shouid be able to build and deploy Phaser with Meteor. Q: Why Meteor? A: Meteor is its own grunt. It automagically bundles, minifies, serves and reloads your project. It has a plugin ecosystem from which Phaser and many other projects can be retrieved. It has support for different JavaScript, HTML and CSS dialects and comes with a reactive pub-sub mechanism that makes authentication, databases and frontend development easier. Fair warning though, Meteor is still pre-1.0 and Windows support is lacking in some areas. Meteorite, the plugin manager, is not directly supported under Windows, although it can be emulated manually. Q: What dependencies does your project have? A: It uses the dependencies CoffeeScript, jQuery, Lo-Dash and PhaserIO. However, jQuery and Lo-Dash aren't used yet, so feel free to remove them if you don't want them. Q: I have suggestions, improvements, criticisms. A: Great! I'm always looking for ways to improve both myself and the projects I work on. Send me a message, a pull request, or even a request via RFC 1149. For my closing remark, I'd like to point out that my Phaser structure was derived/inspired/stolen from the Advanced TypeScript Guide to Phaser. Many thanks for all of the great tutorials!
×
×
  • Create New...