Noid

Members
  • Content Count

    114
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Noid

  1. @John Ng for any function that processes some data and where you can check whether it's returning what it should you can use your favorite test framework. However, if you plan to use TDD for the whole game, I'm not sure it's feasible. You cannot run your game for say 10 seconds, capture a screenshot and expect it to be always the same.
  2. Create if for what you need to get ready for the update loop. There is no need to create all the sprites you are ever gonna need there. You can use the update loop just fine.
  3. Maybe debug.text should output some warning to the console since it severely affects performance and people new to phaser have no way of knowing
  4. It'd be better if you explained what you're trying to accomplish with the code so we can help you. The obj1 at the end is undefined and even if it were, you would end up adding an obj1 property to it that contains { enterMonsterMenu: function() { return console.log('enterMonsterMenu'); } } . It seems that you wanted to call a function instead.
  5. The problem seems to be that the empty space is being trimmed but the engine is not loading the metadata properly. This is part of my atlas.json file {"filename":"Pichon_Vuela00.png", "frame": {"x":865, "y":391, "w":58, "h":58}, "spriteSourceSize": {"x":8,"y":1,"w":77,"h":66}, "sourceSize": {"w":77,"h":66} }, {"filename":"Pichon_Vuela01.png", "frame": {"x":550, "y":411, "w":65, "h":57}, "spriteSourceSize": {"x":5,"y":1,"w":77,"h":66}, "sourceSize": {"w":77,"h":66} }, {"filename":"Pichon_Vuela02.png", "frame": {"x":616, "y":411, "w":64, "h":56}, "spriteSourceSize": {"x":6,"y":0,"w":77,"h":66}, "sourceSize": {"w":77,"h":66} }, If I console.log sprite.width while the animation is running I get the following values: 58, 65, 64. Those are the widths on the atlas image, were the sprites are tightly packed ignoring transparent pixels. However, when extracted from the atlas they should all be 77x66 as defined in sourceSize and spriteSourceSize. Maybe the atlas format changed and my .json file is no longer up to spec, but I can't find the specs anywhere on the repo. UPDATE: I couldn't find the specs but I could find some examples on the examples repo and it seems my json is no longer up to spec. It now needs a "trimmed" : true property in each frame that has been trimmed. Sorry, must've missed the update where that was added. Thanks for all the help, Tom! I think everything's working fine now.
  6. So, for anyone using sprite.anchor.setTo(0.5,0.5) and a body of width A and height B and who was using sprite.body.setSize(A,B,0,0) to get the body centered, they now have to do sprite.body.setSize(A,B,0.5*(sprite.width-A),0.5*(sprite.height-B)). That is, offset to half the width of the sprite minus half the width of the body and half the height of the sprite minus half the height of the body. That works fine now, even with negative values for scale. However, something else must have broken now, cause when I set the anchor to anything other than 0,0 it's starts vibrating. If I set the anchor to 1,1 the vibration is really noticeable and I can notice the character bumping against the wall. I'm adding a gif to demonstrate. I'm using debug.body with sprite.renderable = false so it's easier to see. Notice the erratic movement in the first half of the video(anchor set to 0.5, 0.5) and the smooth movement in the second half(anchor set to 0,0). Setting it to higher values makes the movement even more erratic, even if they're integers. Setting it hi negative values produces the same result. I started noticing this with 2.4.8 but I'm not sure if it's related to fixing #2470 or not so I'm gonna do some bisecting to find out where it started happening. Update: I can confirm the wobbling was introduced in commit f9994fac75c8ed4bf0b84751a1058de1b35e86f4 which is related to fixing #2470
  7. Any migration guide for how the new body anchoring works? I have a prite with anchor set to 0.5,0.5 and size set to (20,30,0,0) With 2.4.7 I could just do sprite.scale.x *= 1 to flip the sprite, now it displaces the body a lot. I'm not really sure how to fix it.
  8. Try the older docs. Get the phaser repo from github and run <repofolder>/docs/index.html
  9. Since you say you're lerning JS, I want to let you know that nothing will have perfect autocomplete for javascript due to the way the language works. Since it's a weakly typed language sometimes there's no way to know what's inside an object until runtime(and that may even change serveral times during execution). Some editors include ternjs which tries to get as much autocomplete info as possible but I'm using sublime 3 with no autocomplete plugin and phaser.io/learn/chains open on a browser tab and I've managed just fine.
  10. I published a game just like the one your're making (https://play.google.com/store/apps/details?id=com.purpleghost.pichonfull) last year so I can tell you how I ended up solving the same problems. All I say implies I'm using arcade physics though in retrospect maybe I should've used P2. You should test both now to see which one you find more suitable before it's too late. Regarding bounce, I have a variable that holds the jump speed and apply that whenever body.onFloor() is true. Using onFloor you avoid having it bounce when it touches the sides or bottom of a tile. Regarding pass through blocks, I didn't use any of those but collide() allows you to define a callback so you can do additional checks before returning true or false. you can check that the player is falling and colliding with the top of the pass-through tile or return false otherwise. When you collide a tilemap with a sprite you can also decide what to do besides separation in a collision callback. The callback will provide a reference to the sprite and the tile that are colliding, so you can check the tile index and decide what to to in each case. Is is a spring? Let's make the player jump higher and faster. Is it a spike? Let's kill the player. Is it the exit door? Let's exit the level. You can have collision callbacks assigned to a tileindex with setTileIndexCallback() but if every tile in the map is gonna have a callback then I think it's better to just add a callback to collide() and check the tile index yourself
  11. EXACT_FIT will stretch/squash the image if you scale to a different aspect ratio. You could also implement your own "fit best" scaling function that scales the image uniformly until it fits the width or height of the screen(whichever generates less cropping).
  12. Noid

    Pichon

    There was an early alpha with placeholder art I uploaded to Newgrounds to get feeback.
  13. Noid

    Pichon

    Pichón is a puzzle platformer where you play as a chubby bird that's constantly bouncing. Fast reflex and good timing will allow you to sort obstacles, activate secret passages and collect the necessary gems to be able to open the door at the end of each level. This is my first Phaser Game and it's available right now on Google Play. Trailer: https://youtu.be/LfQ3gTSyaJo Store URL: https://play.google.com/store/apps/details?id=com.purpleghost.pichonfull Press Kit: http://indieghost.com/press/sheet.php?p=pichon
  14. Cool! I've played some of the early versions of AO. Unfortunately I think Phaser doesn't support animated tiles. You can probably use an instance of Phaser.BitmapData as a tileset image and then use BitmapData.copyRect() to paste the required frames at regular intervals. I don't know how fast it'd be but it'd probably be faster than using Phaser.Tilemap.replace(). Since this might be useful for my game too, I'll try to make it work and post the code as soon as possible.
  15. The emulator in IntelXDK doesn't play mp3s. If it doesn't properly inform what is capable of playing, phaser will just pick the first option. This happens with Opera to. Just put the ogg files first in the array. Going from 44100 to 8000 will noticeable degrade sound quality.
  16. Any of the phaser boilerplates using gulp or grunt also have the possibility of launching a webserver and automatically reloading the page when any of the files change. There also very lightwight servers that consist of a single executable. If you have a relatively old dropbox account you can even use the public folder to host your games. You can even test your game without any gameserver at all by temporarily disabling some security features in your browser(not recommended). Using a VM is completely overkill if the server's not gonna do anything other than serve the game files.
  17. 1) An RSS feed would be nice. I don't know how other people keep track of websites they like but I rely on RSS and I think other technically oriented people do too. You can also use something like Hootsuite and post to twitter, facebook, g+, etc. with one click. I always forget to check the news section unless you happen to post something about it on twitter or someone links to an article on slack. 2) I think the price is ok. However, Phaser being free means it's used by people all around the world, so 40USD might be cheap or expensive depending on who you ask. Don't make it cheap. Offer discounts from time to time like steam does. I don't need a powerful particle plugin but if you tell me it's 50% off for the next 24hs maybe I'll buy it just in case. 3) I'd absolutely spend more on knowledge than tech. Not everyone needs the extra functionality provided by plugins, but everyone needs to know how the engine works, and what you can do with it that you may not be aware of. I think it's better to sell complete issues rather than separate articles. I prefer to pay once and get the whole package, even if I don't need all of it, than having to pay each time I want to read part of it. 4) You could put the content you author on Interphase and use the newsletter to keep people up-to-date on what's posted on the news section. 5) You could allow people to register and upload info about their studio and games. Then you can have a section called phaser made games where people can browse for games made with phaser. The ones that get more views/clicks get featured on the front page, as well as your "staff picks". Even if it doesn't get much traffic, you still get a lot of (easy to process)info on who's using phaser and what kind of games they're making with it.
  18. I'm experiencing some weird bug when my game loses focus as you can see below: About a second after the game loses focus, game.world.position and game.world.worldPosition become 0,0. Camera position is unaffected. It doesn't happen if I switch to another tab, I can use the developer tools to check the value of game.world.position and see they remain unchainged. It only happens when the game loses focus and the tab is active and visible. I've manage to reproduce this bug on chrome and firefox, and using phaser 2.4.4-dev, 2.4.3, 2.4.2 and 2.3.0. I thought it might be something related to camera.follow() so I've tried not following any sprite and manually setting the camera position somewhere other than 0,0, and I observe the same behavior. It doesn't seem to happen in the examples at phaser.io EDIT: I've managed to find why it happens. I have game.scale.setResizeCallback set to call a function that itself calls resizeWorld() on the tilemap layer. I can workaround the bug by calling resizeWorld() only if game.paused is false.
  19. This is the biggest map in my game and it works fine on a Moto G xt1032 as long as it's the only layer. Having more than one layer also works fine on desktop, but the performance starts suffering on mobile. I'm colliding the character sprite against the tile layer, and swapping a big amount of tiles every second. Putting all collidable tiles on a separate layer and rendering it would probably be slower, since I think each layer will be a separate draw call. If you use setCollisionByExclusion phaser will calculate the faces that collide only once, so it doesn't matter how big the exclusion array is. https://github.com/photonstorm/phaser/blob/v2.4.3/src/tilemap/Tilemap.js#L887
  20. If you put game.camera.y -=10; in the update function in your games state it should go up 10px every frame.
  21. this is bound at runtime to the calling function. In you code this will be set to whoever called lostLife(). The one calling lostLife must have a property called game containing a reference to a Phaser.Game if you want this.game.time.... to work as intented.
  22. Apps usually wait for some input, process it and return some output or new state. They react in a predictable way. Games are realtime, interactive simulations. You can test if an image processing app returns an image with its colors inverted. As long as the output is correct you don't care whether it took 1 second or 5 depending on the hardware. With a game you have 0.016 seconds to take inputs, process them and present the new state to the player. You may test your collision code and see that it separates the collided objects as intended, but when you run the game the particle emitter makes you skip a frame here and there on lower end hardware and since you used discrete collision detection your sprite now appears to randomly go through walls. So while you can unit test parts of your game code, I don't know if you'll find someone advocating "test driven game development" as a viable general approach.
  23. A state in Phaser(or Flixel) is what you would call a scene in other engines so it wouldn't be the right approach for what you want to achive. The most straightforward way I can think code based on your code would be to check the value of this.reverse inside playerHund and playerWolf to decide if they're gonna react to input or not. That way you can still update them(they may still animate, or react to damage, etc) but they'll ignore all input when not being controlled. Also, in: this.game.physics.arcade.collide(this.schaaf, this.end, function(){ this.reverse = true; console.log("jetzt"); }); you should add one last argument: this.game.physics.arcade.collide(this.schaaf, this.end, function(){ this.reverse = true; console.log("jetzt"); }, this); That would ensure that the this in this.reverse refers to what you want it to refer to. If you don't know how this works in javascript I suggest you read https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch1.md
  24. Before this.jimAliveTimer.. you can add console.log(this) to see what this is refering to. It's hard to tell where's the error without looking at the rest of the code but what the interpreter is telling you is that you want to access a property called time inside this.game but this.game is undefined. If you're new to javascript I suggest you read https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch1.md
  25. That should work. Try adding game.camera.unfollow() at the end of your create function. If that works then you've set the camera to follow some sprite earlier in your code(it may happen if you're using some example/template as a starting point.