Search the Community
Showing results for tags 'Not Working'.
-
I'm trying to add a bubble-pop spritesheet animation to my game. I have added other sprites fine, and when I add the sprite for the bubble, everything is still good. However, when I go to add the animations, I get an error, "Cannot read property 'add' of undefined. How can I animate the bubble? var config = { type: Phaser.AUTO, width: 1366, height: 768, parent: "canvas", scene: { preload: preload, create: create} }; var game = new Phaser.Game(config); function preload () { this.load.image('freeplayBG', 'images/freeplay-BG.png'); this.load.image('shark', 'images/nice-shark.png'); this.load.spritesheet('bubblePop', 'images/bubble_pop_under_water_spritesheet.png', {frameWidth: 394, frameHeight: 511} ); } function create() { //Set background this.add.image(685, 384, 'freeplayBG'); //Set shark and make draggable var shark = this.add.sprite(200, 300, 'shark').setInteractive(); this.input.setDraggable(shark); this.input.dragDistanceThreshold = 16; this.input.on('drag', function (pointer, gameObject, dragX, dragY) { gameObject.x = dragX; gameObject.y = dragY; }); //create the bubble sprite var bubble = this.add.sprite(700, 300, 'bubblePop'); console.log(bubble); //Sprite {_events: Events, _eventsCount: 0, scene: Scene, type: "Sprite", parentContainer: null, …} console.log(bubble.animations); // undefined console.log(this) //Scene {sys: Systems, game: Game, anims: AnimationManager, cache: CacheManager, plugins: PluginManager, …} bubble.animations.add('pop'); //error happens here bubble.animations.play('pop', 10, false, true);
- 1 reply
-
- not working
- sprite.animations
-
(and 10 more)
Tagged with:
-
Hello! Im new here, and I'd like some help. I was coding, made a new spritesheet and tried making it play while I press a key. It doesn't seem to be working, and I don't know why. If you could help in any way, it'd be greatly appreciated. Thanks! CODE - https://pastebin.com/Sciaw2uY SPRITESHEET -
- 2 replies
-
- help
- animations
-
(and 5 more)
Tagged with:
-
I am just starting with phaser and have built Pong as my first project to digg into it. There is one problem I just can't solve: If I test the game locally the audio plays, if I publish it to my webserver, the audio does not play. I sense it may have to do something with access rights (do I maybe need to add an htaccess?), or the web server settings are not correct. My dev environment: Visual Studio 2013, Typescript, Phaser 2.3.0. If you need any further details (e.g. from my web hoster) to tell me what's going wrong, please don't hesitate to ask. Game on the web server: http://games.martinbeierling.de/pong/ Sound that should play when the ball hits the player: http://games.martinbeierling.de/pong/assets/hit.wav The code is working, as it plays it correctly when I test it locally by running it from Visual Studio in Google Chrome. -> preload the assets function preload(): void{ game.load.audio("hit", "/assets/hit.wav"); game.load.audio("explode", "/assets/explode.wav");}-> in create, add the sounds hitSFX = game.add.sound("hit");explodeSFX = game.add.sound("explode");-> at the triggers, play the sounds hitSFX.play();
- 6 replies
-
- audio
- not working
-
(and 1 more)
Tagged with:
-
Here is my simple code: <html> <head></head> <body> <canvas id="renderCanvas"></canvas> <script src="jquery-2.1.4.min.js"></script> <script src="babylon.2.2.max.js"></script> <script> var canvas = $("#renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 1, 2, 10, new BABYLON.Vector3(0, 0, 0), scene); scene.activeCamera.attachControl(camera); engine.runRenderLoop(function () { scene.render(); }); </script> </body></html>When I open that with jQuery and BabylonJS in the same directory, I get this error in Firebug: It works in neither Firefox nor Chrome. WebGL does otherwise work. I can, for example, run https://videos.cdn.mozilla.net/uploads/mozhacks/flight-of-the-navigator/ and the Three.js examples. I get this same problem on both my Windows and my Mac. Anyone have any idea what's wrong? Here is my Firefox-configuration on Windows:
- 19 replies
-
- not working
- problem
-
(and 8 more)
Tagged with:
-
Hi all, So I'm trying to add background music to my game, and I've provided phaser with a .ogg and a .mp3 file so it has a fallback. Problem is, the audio doesn't play/load at all in Google Chrome (latest build). In Firefox the audio is working fine for me. I've looked at some examples on examples.phaser.io and added the audio the same way they did there, like this: game.load.audio('backgroundMusic', ['assets/audio/TakingFlight.mp3', 'assets/audio/TakingFlight.ogg']);Later in the javascript I play the music using this code: backgroundMusic = game.add.audio('backgroundMusic');backgroundMusic.play('', 0, 1, true);Any suggestions / ideas? I've added the mp3 file of the background music in this post, wasn't allowed to upload the ogg.. TakingFlight.mp3
-
Hi, First of all; I'm using Phaser 2.0.0, I have two sprite groups, "newspaper" and "home" and I'm moving the home group with clockwise movement of mouse. I do "game.physics.arcade.enable(sprite);" thing for all sprites in these groups. When i'm trying detect overlap with this code, this.physics.arcade.overlap(this.newspaper, this.homes, (newspaper, home) => { if (newspaper.name == 'newspaper' && home.name == 'newspaper') { newspaper.name = ''; home.name = ''; this.money += 1; } });It doesn't work When i'm trying Phaser 1.1.6, it works but i can't use Phaser 1.1.6.. How i can solve this problem ASAP? Thx for answers
- 1 reply
-
- ArcadePhysics
- Overlap
-
(and 1 more)
Tagged with: