jjwallace

Members
  • Content Count

    146
  • Joined

  • Last visited

Everything posted by jjwallace

  1. Wow, I cannot get past this error. What is causing this?
  2. Here is my CODE //PRELOAD this.load.script('abstracFilter', 'lib/filter/AbstractFilter.js'); this.load.script('displacementFilter', 'lib/filter/pixi/DisplacementFilter.js'); //ON CREATE var displacementTexture = PIXI.Texture.fromImage("assets/img/displacement_map.jpg"); displacementFilter = new PIXI.DisplacementFilter(displacementTexture); //UPDATE countDisplace = 60; displacementFilter.offset.x = countDisplace * 10; displacementFilter.offset.y = countDisplace * 10; this.filter = [displacementFilter];
  3. Was able to clear all my errors however i still see no filter.
  4. The console points me to this code but everything is in the correct places: var core = require('../../core'); // @see https://github.com/substack/brfs/issues/25 var fs = require('fs'); /** * The DisplacementFilter class uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object. * You can use this filter to apply all manor of crazy warping effects * Currently the r property of the texture is used to offset the x and the g property of the texture is used to offset the y. * * @class * @extends PIXI.AbstractFilter * @memberof PIXI.filters * @param sprite {PIXI.Sprite} the sprite used for the displacement map. (make sure its added to the scene!) */ function DisplacementFilter(sprite, scale) { var maskMatrix = new core.Matrix(); sprite.renderable = false; core.AbstractFilter.call(this, // vertex shader fs.readFileSync(__dirname + '/displacement.vert', 'utf8'), // fragment shader fs.readFileSync(__dirname + '/displacement.frag', 'utf8'), // uniforms { mapSampler: { type: 'sampler2D', value: sprite.texture }, otherMatrix: { type: 'mat3', value: maskMatrix.toArray(true) }, scale: { type: 'v2', value: { x: 1, y: 1 } } } ); this.maskSprite = sprite; this.maskMatrix = maskMatrix; if (scale === null || scale === undefined) { scale = 20; } this.scale = new core.Point(scale, scale); }
  5. Having trouble implimenting Pixi in Phaser. However i run into this problem below. Files are located all correctly including core and abstractfilter and displacement filter. Uncaught ReferenceError: require is not defined(anonymous function) @ VM10606:1c.Loader.fileComplete @ phaser.js:74078c.Loader.xhrLoad.f.onload @ phaser.js:73590 Any Clues? I am using this forum for reference:
  6. I tried the method OpherV mentions but have run into a error. Is there any tricks or clues to make this work better? I am getting: Uncaught ReferenceError: module is not defined Uncaught ReferenceError: module is not defined
  7. Yah i figured this was the case. I am not really sure how to carry the scope without dispatch causing a undefined in phaser. //here is me code..... paintGame: function (){ var textScore = this.add.text(this.world.centerX, this.world.centerY, "0", { font: "48px Arial", fill: "#ff0044", align: "center" }); var textTimer = this.add.text(this.world.centerX, this.world.centerY + 40, "0", { font: "48px Arial", fill: "#ff0044", align: "center" }); }, update: function () { var gameTimer = Math.floor(totalTime / 30); this.textTimer.text = gameTimer; //this.textTimer.text = this.gameTimer; },
  8. ////This makes no sense! Any Help? var textTimer = this.add.text(this.world.centerX, this.world.centerY + 40, "0", { font: "48px Arial", fill: "#ff0044", align: "center" }); //update var gameTimer = Math.floor(totalTime / 30); this.textTimer.text = gameTimer; <---------- ERROR ON THIS LINE ///// ERROR: Uncaught TypeError: Cannot set property 'text' of undefined
  9. Awesome! It worked great, thanks Rich!
  10. //Create all of our creatures for (var i = 0; i < 30; i++){ creature.events.onInputDown.add(this.listenerClick, this); console.log(i); } // Essential i want to take var i from above and bring it to the function below. How do i do this? listenerClick: function (sprite, pointer) { console.log(sprite); creature[sprite].scale.set(0.0); },
  11. Is there a correct way of doing this? For some reason it cannot find remove clickButton: function () { //this.uiGroup.remove(); this.remove(this.uiGroup); },
  12. jjwallace

    Show FPS

    That does not work. is there a simple this.debug.fps;
  13. Hmmm. Well i would really like to place a few buttons and some text fields inside a group and align it to the right. Essential making a nice GUI, i am trying to find the best method to do this. I am guessing to align a group you must just subtract its width and then set its x to the right side. Interesting.
  14. //var uiGroup; uiGroup = this.add.group(); uiGroup.create(this.world.width, this.world.height, 'guiGroup'); uiGroup.anchor.setTo(1,0); ERROR Uncaught TypeError: Cannot read property 'setTo' of undefined
  15. for (var i = 0; i < 40; i++){ if(Math.floor((Math.random() * 4) + 1) == 3){ fishyitem = 0; fishy = this.add.sprite(this.world.randomX, this.world.randomY, 'egg1'); fishy.scale.set(0.2 + (0.03 * Math.floor((Math.random() * 10) + 1))); fishy.angle = -180 + Math.floor((Math.random() * 360) + 1); fishySpeed = 0; fishy.inputEnabled = true; fishy.input.useHandCursor = true; //if you want a hand cursor fishy.events.onInputOver.add(listenerClick, this); //<------------------------------------------------------ and the button listenerClick: function (sprite, pointer) { fishyitem = 10; fishy.loadTexture = 'fish1'; },
  16. Looking for an experienced HTML5 phaser game developer in the New York city for a full time gig. Let me know if anyone is interested.
  17. Hi i am using Phaser to make a video flipbook. I load my videos in my preloader like this. this.load.video('myVideo1', 'assets/video/video1.mp4');this.load.video('myVideo2', 'assets/video/video2.mp4'); I add my video to my game like this:this.video = this.add.video('myVideo1'); I want to use the change source like this;this.video = this.add.video('myVideo' + curScene.toString); I am using the last part wrong... But i wana use my preloaded video
  18. I am also confused by this, what does the json file look like?
  19. Hello i am trying to make a small application for video in html5. I would like to load a video but i am doing something horribly wrong. I am using the hello world for phaser. I have tried both Phaser.js and phaser.min.js Neither one seems to work with video. MY CODE IS BELOW <!doctype html><html> <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <script src="Phaser.js"></script> </head> <body> <script type="text/javascript"> window.onload = function (){ var game = new Phaser.Game(720, 480, Phaser.AUTO, '', { preload: preload, create: create }); function preload () { game.load.image('logo', 'phaser.png'); game.load.video('myvideo1', 'video1.mp4'); } function create () { var logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo'); logo.anchor.setTo(0.5, 0.5); video = game.add.video('myvideo1'); video.onPlay.addOnce(start, this); sprite = video.addToWorld(400, 300, 0.5, 0.5); video.play(); } }; </script> </body></html>