KevinnFtw

Members
  • Content Count

    52
  • Joined

  • Last visited

Everything posted by KevinnFtw

  1. Edit: Nevermind, was being stupid... because it already multiplies the color I should just use more transparent color codes.
  2. As far as I know my game itself is not using any xml, but I will look into it. Thanks!
  3. Hi guys, Today I'm trying to get my game running in CocoonJS, the game does work perfectly in a normal desktop and mobile browsers, but I'm getting some errors in CocoonJS. The error says: Javascript Exception (Tag: 'load'): Error: Phaser.Loader. Invalid XML given at e.Loader.xmlLoadComplete(js/min/phaser.min.js:12:9823) at XMLHttpRequest.i.xmlURL._xhr.onload (js/min/phaser.min.js:12:7414) It's my first time using CocoonJS so I have no idea where the error is coming from, but it is coming from Phaser.js itself. Any ideas?
  4. So you do like: sprite.destroy(); player.destroy(); enemy.destroy(); Do you destroy every element seperately?
  5. Wait, isn't that what this.world.removeAll() is supposed to do? Doesn't that function destroy every element of the stage world?
  6. Thanks for your reply Loopeex :-) I've tried: shutdown: function() { this.world.removeAll(true);}But that doesn't make any difference unfortunately
  7. Hey guys, I'm having some issues switching between states. In the first run it all works fine, but then when I come back to a state I've already been at, like MainMenu, the design is all messed up. I think it is because not all sprites and stuff are removed when I switch states, that's why I added a this.world.removeAll() in my shutdown function. However that doesn't seem to do anything. Is there another short way to delete everything (except cache) from a state before switching to another state, or does it have to be done manually? I've attached 2 images, one of my MainMenu first time, and one of the MainMenu when I switch back to it (after the Game). Excuse me if it is a silly question, I've just recently started using states.. Thanks, Kevin
  8. Ahh, i was thinking about the 'this' reference, but didn't know what to replace it with. Edit: Awesome, it is working now! Thanks alot Rich and Lewster32 :-)
  9. I've uploaded the Game.js here: http://jsbin.com/senarewe/1 The problem is occuring at the createBullet() and createPlayer() functions.
  10. I get that, but some of my functions need to have a couple of variables to work. Normally, when I want to execute a certain function with parameters I would just call: function(a); I know that at states you have to use this.function if the function is inside of the game. So then I would call this.function(a) However when I do that I get the error Uncaught typeError: undefined is not a function The function(a) does exist. Edit:It might be that the context I'm using the function in is wrong, and not the function itself. I'm using it within a socket.on like: socket.on('newBullet', function(data) { this.function(data);});
  11. Yeah I know that, but most of my functions need one or more parameters. How should I handle them?
  12. Hi guys, Maybe a silly question, but I recently started using States in my game and now I am converting my functions to work with states. The functions without parameters work fine, but the ones with parameters don't. For example, when I call: this.createBullet(x, y); I get the error: Uncaught typeError: undefined is not a function. The function createBullet(x, y) does exist, it is created like this: createBullet: function(x, y) { // blablabla content of function } p.s. these functions are in my Game.js state Can anyone tell me what I'm doing wrong? It has to be a silly mistake but I don't know how to fix it Thanks, Kevin
  13. That's a great solution as only one of them is moving at a time. Thanks!
  14. Hi guys, At the moment I'm having some issues detecting which sprite is overlapping another sprite. The overlap function works fine, but I would like to know which of the 2 sprites goes over the other sprite. I only want to execute a certain function if sprite A walks over sprite B, and not if sprite B walks over sprite A. Is there any way I could check this inside of the overlap function? Thanks, Kevin
  15. Hey Rich, I'm using Phaser 2.0.5, but there's no such option to bring text to the front/top. I also couldn't find it in the latest docs. Do I have to put all the text elements in a group and bring that to top or is there any other way? Thanks.
  16. So I'll just need to do sprite.body = null? If I want to re-enable the body of the sprite in a later stage where the sprite is visible again, how should I do that?
  17. Hey guys, In my game I hide some sprites by setting their visible setting to false. Problem is, my collision detection still detects if these invisible sprites are getting hit. I would like to know how I can make the collision detection ignore them. Recently I've seen a option on these forums which was something like sprite.collision = false. I think it was an option to ignore the collision of a certain sprite. Too bad I can't find that post or option anymore, so that's why I'm making a new post about it. Hope anyone can help me, otherwise I'll have to write my own detection for just visible sprites but enabling some kind of option would be much easier. Thanks, Kevin
  18. Very nice example! That did the trick for me, thanks alot :-)
  19. Hi, I'm creating a shooter game, and I've followed the 'Space Invaders' example. Everything is working but one thing, I would like to have infinite ammo, so CreateMultiple has to be infinite. It requires a value, so I don't know how to make it actually infinite. Basically what I want to do is create a couple bullets and recycle them over and over again. Any suggestions on how I could do so you never run out of bullets? Thanks in advance, Kevin
  20. Oh wow, is it really that simple? Man... how could I have not thought about that! Will try it now, thanks for your answer and example! Edit: @jpdev, you are the man! Your answer is working great and saved me alot of time. Thanks dude
  21. Well I see what you are doing there, however I'm already using most of the default properties on my sprites.
  22. Hi, I would like to know if it is possible to create more properties for a sprite. For example, I'm creating a multiplayer game that is based on GPS, so I would like to assign a latitude and longitude to a sprite. So I would like to do it like this: sprite.latitude = value; sprite.longitude = value; Is this possible out of the box, or do I have to modify the phaser.js to achieve this? Thanks in advance, Kevin