SamPotasz

Members
  • Content Count

    8
  • Joined

  • Last visited

About SamPotasz

  • Rank
    Newbie

Contact Methods

  • Website URL
    https://twitter.com/sampotasz/
  • Twitter
    SamPotasz

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

604 profile views
  • rui

  1. SamPotasz

    Blank webcam

    Oh, and Webcam.js is taken from https://github.com/photonstorm/phaser-plugins/blob/master/Webcam/Webcam.js
  2. SamPotasz

    Blank webcam

    Hi y'all, I'm having trouble getting the Webcam plugin running in my game for some reason. Seems like it should be simple enough judging by the example: https://phaser.io/examples/v2/misc/webcam When I start the plugin from inside my Game state, the plugin starts, my browser asks for permission to access the camera, and then I get a completely blank screen - no output from the camera. Or the output is printing somewhere that's not being added to the game. Here's my code: BasicGame.Game = function(game) {}; BasicGame.Game.prototype = { preload: function() { this.game.load.script('webcam', '/src/utils/Webcam.js'); }, create: function() { var webcam = this.game.plugins.add(Phaser.Plugin.Webcam); console.log(this.game.plugins.plugins); var bmd = this.game.make.bitmapData(600, 450); var sprite = bmd.addToWorld(); webcam.start(600, 450, bmd.context); }, update: function() { }, }; The plugin is definitely added and then started so I really don't know what the issue is! Any help is appreciated :-) Thanks, Sam
  3. It works! Here's my (probably naive) solution: In index.html, add a blank hyperlink like so: <a href="" id="link"></a> then when I want to save the image, I call this function: saveImage: function() { var url = bmd.canvas.toDataURL('image/png'); var link = document.getElementById('linkID'); link.href = url; link.download = PAGE_TITLES[pageIndex] + ".png"; link.click(); }, I'm not sure about its cross-platform performance, and it doesn't show a "Save as..." dialog, but it's good enough for me.
  4. Thanks! I will experiment and report back!
  5. I have a simple coloring book app, and I want to give the user the option to save what they've drawn to their computer. Within the app, the drawing is done on a bitmapData object. Is this at all possible? Thanks, Sam
  6. I just ran into this problem, and I disagree with GrindheadGames' answer. The solution for me was to make sure all text objects' x positions were whole numbers. Additionally, if your text objects are nested within other objects, those too should be placed at integer positions. A simple text.x = Math.round( text.x ) should do the trick! FWIW, I'm using webfonts as demonstrated here (http://phaser.io/examples/v2/text/google-webfonts). I'm not sure if this problem or answer applies to system or bitmap fonts.
  7. Thanks, Rich! The solution for me was that my top sprite which I wanted to cover up input for the sprites below it was not inputEnabled. The example was very helpful.
  8. Hi all, Is it possible to disable clicking "through" a sprite? As in, if Blanket sprite covers up the Mattress button/sprite visually, is it possible to disable input for the Mattress? Is it best to check on each of Mattress' touch events that it's not covered up? That seems pretty messy, and I'm wondering if I'm missing something since clearly Phaser already knows which sprite is on top. Thanks, Sam