• Content Count

  • Joined

  • Last visited

About wombat

  • Rank

Recent Profile Visitors

857 profile views
  1. @Yanifska: I'd like to help but I don't remember. The .ogg files were created in Audacity, and if I load one back it says Stereo, 44100Hz, 16-bit PCM. I don't know if that's the setting your'e asking about. The link above is still valid though if you want to have a look at the .ogg files yourself.
  2. Hi, I'm not sure what you mean by getting Phaser.io to work on cloud9, so I'll tell what I know and hope what you need it's in there somewhere. This is how to copy all the Phaser examples to cloud9 to play around with 1. Your project has to be public, otherwise you won't be able to view it 2. Just supplying the url of the github repository when creating a new project doesn't work I think , instead, create a new empty project, (public!) and clone the repository from the command-line, ie enter git clone https://github.com/photonstorm/phaser-examples.git3. To view the examples, you open the index.html file in the editor (it's in the examples/ directory) and click "preview". This will open the page in the browser. 4. If what you wanted was just to get your own project to run in cloud9, it's the same procedure. Create an index.html file that loads phaser.js and your own js files, and "preview" the index.html file. 5. There's a post around here somewhere where I got help with the same problem, but I can't find it now. I use Chrome, I belive there was some additional weirdness when I tried do this in Firefox.
  3. ...here's something that works, kind of: sprite.anchor.setTo(1.6, 0.45);although it expresses the offset in sprite dimensions ("draw top left corner 1.6 times sprite.width to the left of center") so it's a bit tricky to get right. Also it's a PIXI.Sprite attribute so I don't know if it's safe to mess with it. @CtlAltDel When I tried that there was a lag, so I thought that when I moved the camera in the update() I was out of sync with the world's movements. When the sprite was accelerating/decelerating (fast) it would change its position on the screen. When I set the anchor as above it doesn't do this. I believe that's because the camera position isn't normally updated in the update() function? @Heppell08 As I understand it the camera follow styles define an area of the screen in which the sprite can move without the camera following (i e without the background and other sprites scrolling). Perhaps I can define a really small area (1x1 pixel perhaps) at the place where I want the sprite to be 'locked'? I'll give it a try, though maybe I'm not really understanding how it's supposed to work. Edit: Ta-da! game.camera.deadzone = new Phaser.Rectangle(200,380,1,1);
  4. Thank you, but specifying Phaser.Camera.FOLLOW_LOCKON changes nothing. It's the default value. // Phaser.Camera sourcefollow: function (target, style) { if (typeof style === "undefined") { style = Phaser.Camera.FOLLOW_LOCKON; }
  5. That's interesting. How do I know when I have to worry about objects not being initialized? Can I be sure that if the objects have time enough to initialize on my computer, the code will work on any computer? Or should I always put a setTimeOut statement after I create the game object? Should I do some kind of testing to find out if there are other places in the code where this could happen?
  6. Hi all, I want to make the camera follow a sprite so that the sprite is always in the same position on the screen. Updating the camera's position in the 'update' works, but with a lag (i e when the player is moving fast the surrounding doesn't catch up with the sprite immediately. Not working 1: // in the 'update' functiongame.camera.setPosition(this.player.sprite.x - 10, this.player.sprite.y - 50);Setting the camera to follow the sprite does what I want, except that the upper left corner of the sprite is in the center of the screen. Not working 2: game.camera.follow(this.player.sprite);Then I thought I could make my player sprite a child of a group, add another (invisible) sprite to the group at an offset, and have the camera follow the invisible sprite. I want the player to have a physics body however, and from what I understand I cant enable physics on the parent Group. (I can pass the group to game.physics.enable, but there's no 'body' set on the group). Out of ideas. How can I make the camera 'follow' the sprite, instantly, but with an offset?
  7. Thank you. Since I believe the .ogg files are loaded as first choice, I guess there's something with the encoding of these that the native browser doesn't like. Not loading these (using just mp3) works, until I figure out what is wrong with the oggs. EDIT: Turns out I didn't change that at all, I only thought I did. Instead, sound seems to have started working mysteriously on it's own accord. Hm. Sorry for wasting your time folks, if I come up with something useful I'll post it here.
  8. On android I can play my game in Chrome and Firefox browsers, but on the stock browser there's no sound. Any ideas where I should start looking? I have my sounds encoded as ogg and mp3. Edit: the game in case someone is interested
  9. Thank you. Does that mean that the 'game' instance is not fully initialized when it's created (and returned), but is instead initializing itself at some (not very distant, since waiting for 0 ms is enough to let it complete) later time? Is that a javascript thing or a Phaser thing?
  10. This baffles me. If I do this game = new Phaser.Game(800, 400, Phaser.AUTO, '');console.log(game)console.log(game.add)the output in the browser console is this: >Phaser.Game null However, if I type "game.add" in the console the output is what I expected (ie >Phaser.GameObjectFactory). I ran into this because I wanted to create some shorthands in the start of the script for accessing common functions and making it more comprehensible (to me), like so: var factory = game.add; Please, what's going on?
  11. Hi, I wanted to create draggable buttons with some bitmaptext on them. I ended up with this: // the buttonvar button = this.game.add.button(x, y, "button", 0);button.input.enableDrag(false, false);// an intermediary group, just to be able to set the draggable 'button' as parentvar group = new Phaser.Group(this.game, button);// the text that i want to stick to the buttonvar text = new Phaser.BitmapText(this.game, 2, 2, "main-font", "text!!");group.add(text);Is there a more clever way to do this? For instance, the text has a 'parent' property that I can set directly, skipping the group. text.parent = button; I suppose that's from PIXI.GameObjectContainer. Presently, setting it as above works. Is there a safe way to use it, or some other way to use sprites/images/"gameobjectcontainers" as parents directly?
  12. Hi, how is the stopFullScreen() method meant to be used? I try this (modifying the fullscreen.js demo); function gofull() { game.scale.startFullScreen(); game.scale.stopFullScreen();}and get this: Uncaught TypeError: Object #<HTMLCanvasElement> has no method '' What's that about?
  13. Thanks for your reply! Storing the return value in tween like above doesn't change anything, however. The behavior is the same (In Chrome and Firefox) with this code: tween = game.add.tween(thing); tween = tween.to({x: 10, y: 300 }, 1000, Phaser.Easing.Bounce.Out); tween = tween.to({x: 200, y: 300 }, 1000); tween = tween.to({x: 200, y: 100 }, 1000); tween = tween.to({x: 10, y: 100 }, 1000);Anyway, am I missing something here? As I understand it, the .to() method doesn't return a new anything, it returns the 'tween' instance on which it was called, for chaining. So the var tween is referncing the same instance all along.
  14. Hi, I want to check whether a sequence of tweens has completed. However, the 'isRunning' flag only indicates whether the first step is 'running'. During step 2-4 in the example below it's set to false. It will be set to true again on the first step if the sequence loops. Is this how it's supposed to work? Is there a simple way to check whether the entire (non-looping) sequence has completed? var game = new Phaser.Game(640, 480, Phaser.CANVAS, '');var tween;var thing;var main_state = { create: function() { thing = {x: 10, y: 100 }; tween = game.add.tween(thing); tween.to({x: 10, y: 300 }, 1000, Phaser.Easing.Bounce.Out); tween.to({x: 200, y: 300 }, 1000); tween.to({x: 200, y: 100 }, 1000); tween.to({x: 10, y: 100 }, 1000); // tween.loop(); tween.start(); }, render: function() { game.debug.text('tween.isRunning: ' + tween.isRunning, thing.x, thing.y); }};game.state.add('main', main_state);game.state.start('main');
  15. @gonzalez32: Sorry for not answering, I've been away from the forum. Yes and no, the 'solution' that I found was using Firefox instead of Chrome when on Koding. (The code works fine in Chrome in general, it's just when using Koding, which really is quite slow, that this particular strangeness occurs). I've tried cloud9 as well, which works with both Firefox and Chrome, as long as you remeber to use public projects.