coltonoscopy

Members
  • Content Count

    16
  • Joined

  • Last visited

About coltonoscopy

  • Rank
    Member

Contact Methods

  • Twitter
    Noegddgeon

Recent Profile Visitors

575 profile views
  1. Hi! I noticed that the described fix doesn't actually work in my current project, though the font definitely does work when it's just used in a DOM element. I also tried converting the font in question to WebFont and using that, as well as the preload hack by creating a text object in a boot phase of the game, but none of these options seem to work. https://github.com/coltonoscopy/phaser3-pong https://github.com/coltonoscopy/phaser3-pong/blob/master/index.html https://github.com/coltonoscopy/phaser3-pong/blob/master/TitleScene.js Rather than displaying the font it's supposed to, it just seems to be displaying some kind of Serif font (should be testable out of the box with a simple CLI server). Anybody know what the best way to go about making this work is? Thanks so much for your time and help!
  2. Using Browserify and coffeeify together to bundle everything into one file helped fix the problem.
  3. I think I know what the problem is based on this SO question: http://stackoverflow.com/questions/29944526/how-do-you-correctly-import-react-into-a-node-webkit-app Using NW and requiring modules puts NW in "Node" mode instead of browser mode, where "document" is unavailable; the solution is to bundle everything up using Browserify.
  4. Doing that then seems to break 'document' being found; does that happen to have anything to do with the fact that I'm using Node Webkit? Thank you for your help!
  5. Hey guys! So I'm trying to write a CoffeeScript + Phaser game running on Node Webkit and have had no problems until trying to write classes that extend Phaser functionality when included in separate files. Something like the following: class Creature extends Phaser.Sprite constructor: (x, y, sheet) -> @health = 10 @stats = attack: 10, defense: 10, magic: 10, speed: 10 Phaser.Sprite.call @, game, x, y, sheet game.add.existing @module.exports.Creature = CreatureIt's saying that Phaser is not defined when this class is required and used by my main script, which makes sense because it's not been included in the file... However, my main script doesn't include Phaser either, uses Phaser of course, and doesn't have this problem. Does this have anything to do with the fact that my main script is included in the HTML document itself and thus doesn't need to include Phaser for that reason? Some insight would be greatly helpful and appreciated! Thank you very much for your time and help! Best, Colton
  6. Whoops, sorry! I had tinkered and forgotten to re-compile; here is the 100% pure compiled version, without any changes: // Generated by CoffeeScript 1.6.3window.onload = function() { var create, preload, test; test = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create }); preload = function() { return test.load.image('logo', 'assets/images/phaser.png'); }; return create = function() { var logo; logo = test.add.sprite(test.world.centerX, test.world.centerY, 'logo'); return logo.anchor.setTo(0.5, 0.5); };}; What I had been doing though is removing the "return" from create, just because that was showing up as a syntax error in Sublime. It still ran, so I'm not sure if that's actually legal in JS, but I felt it was better to be safe than sorry. Ah, that's kind of a pain... so I'll just need to define the functions in CS before they're called within the Phaser constructor? EDIT: This has been confirmed as a fix. Would still be nice to know if there's a way to do it such that the functions could still be declared below the Phaser.Game() call, if CS allows for this. EDIT AGAIN: Turns out CS only supports function expressions per https://arcturo.github.io/library/coffeescript/07_the_bad_parts.html ! Went ahead and ran the -b flag, compiled to the JS I linked up top in this reply! :] Thanks you guys for your help! Best, Colton
  7. 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
  8. Awesome! Thanks jahow and Deltakosh! Can't wait to test it out! Best, Colton
  9. Hi jahow, Thank you for your reply! A bummer that there isn't really an interface for it yet; it'd be a great thing to have access to, as my goal was developing a sort of Doom-like game where the enemies are sprites but retain that sort of 16-bit spritey look. Best, Colton
  10. Hi Xeonzinc, Thanks for the reply. I took a look at that thread before creating this one, but I was unable to figure out what I needed to do with Sprites specifically in order to take care of the filtering issue. Looking through the API didn't help either; there appear to be no methods or members within the Sprite or SpriteManager class that give direct access to the Texture and therefore texture filtering. Best, Colton
  11. Hey guys, Is there a way I can disable texture filtering on my Sprites? I'm using 32x32 sprites and when they're enlarged, they look blurry and awful. I was unable to figure out through the API and Google how to change a Sprite or SpriteManager's Texture filtering method, so some guidance would be much appreciated; thank you! Best, Colton
  12. Hi Arcanorum, Thank you for your response. Sorry for the funkiness of the site; a lot of things are sort of in progress simultaneously, but it's good to know that velocity is the way the physics system does its collision; that's what was dodging my attention. Since the game is to be more or less grid-based in movement, I've transitioned to calculating collision manually and avoiding the physics system for now. Best, Colton
  13. Hey guys, In trying to implement fixed movement in my game (i.e., the player moves in increments of one tile on my TileMap at a time, which in this case is 64 pixels), collision is not working at all. Here is the relevant code: function create() { socket = io('http://coltonoscopy.com:8120'); game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; game.scale.refresh(); game.world.setBounds(-500, -500, 1000, 1000); map = game.add.tilemap('level', 32, 32, 200, 200); map.addTilesetImage('tiles1', 'tiles'); layer = map.createLayer('World1'); layer.resizeWorld(); layer.wrap = true; layer.fixedToCamera = true; layer.smoothed = false; layer.setScale(2); var startX = Math.round(Math.random()*(1000)-500), startY = Math.round(Math.random()*(1000)-500); player = game.add.sprite(startX, startY, 'icons'); player.frame = 1985; player.anchor.setTo(0.5, 0.5); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.maxVelocity.setTo(400, 400); player.body.collideWorldBounds = true; map.setCollision(tileTypes.ocean, true, layer, true); enemies = []; player.bringToTop(); game.camera.follow(player); game.camera.deadzone = new Phaser.Rectangle(150, 150, 500, 300); game.camera.focusOnXY(0, 0); cursors = game.input.keyboard.createCursorKeys(); cursors.left.onDown.add(function() { player.x -= 64; }); cursors.right.onDown.add(function() { player.x += 64; }); cursors.up.onDown.add(function() { player.y -= 64; }); cursors.down.onDown.add(function() { player.y += 64; }); setEventHandlers();} function update() { // if we're in exploration mode... if (gamemode === 0) { game.physics.arcade.collide(player, layer); for (var i = 0; i < enemies.length; i++) { if (enemies[i].alive) { enemies[i].update(); game.physics.arcade.collide(player, enemies[i].player); } } layer.x = -game.camera.x; layer.y = -game.camera.y; socket.emit("move player", {x: player.x, y: player.y}); } else { }}Help in pinpointing the reason why would be much appreciated! If you want, you can check out the live site at http://coltonoscopy.com:5000/ as well to see what I mean (the player shouldn't be allowed to walk on ocean tiles). Thank you very much! Best, Colton
  14. Hi Rich, Thanks for your reply! I tried setting the immediate flag to false in the setPixel calls and then calling update() once the loop has finished, but unfortunately, the page still crashes :/ What I wanted to do originally was just render the TileMapLayer to a new Sprite and then render a scaled version of that, which seems like it would be more efficient, and as linked in the following thread, but nobody responded: http://www.html5gamedevs.com/topic/12664-creating-rendertexture-from-tilemaplayer/ The goal is simply to take the current TileMapLayer being rendered and render a small (200x140 or so) version of the entire thing so the player can see what the entire map looks like at a glance. If you've played Final Fantasy 6, it's sort of what happens in that game during the overworld, except that map is likely pre-constructed. Best, Colton
  15. Hey guys, So, I'm trying to generate a BitmapData from a TileMap in real time (basically, a 1:1 pixel for tile image to act as a minimap) and assign it to a Sprite, but the weight in computation from doing so on a map that's 2000x2000 tiles in size causes the entire game to crash. Here's my code: // create new BitmapData the size of our tile map bmd = game.add.bitmapData(map.width, map.height); // for each tile in our map, set the pixel of our bmd to the right color for (var i = 0; i < map.width * map.height; i++) { var x = i % map.height; var y = Math.floor(i / map.height); console.log("X: " + x + ", Y: " + y); if (map.getTile(x, y, layer).index == tileTypes.grass) bmd.setPixel(x, y, 0x00, 0xFF, 0xFF, 0xFF); if (map.getTile(x, y, layer).index == tileTypes.ocean) bmd.setPixel(x, y, 0xFF, 0x00, 0xFF, 0xFF); } var bmdSprite = game.add.sprite(1000, 510, bmd); bmdSprite.fixedToCamera = true; bmdSprite.bringToTop();What would the best solution to this be? Am I perhaps doing something fundamentally wrong? Thanks for your help! Best, Colton