crysfel

Members
  • Content Count

    15
  • Joined

  • Last visited

About crysfel

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location
    New York, NY

Contact Methods

  • Twitter
    crysfel
  1. I think you need to pass the game instance, look at the code (line 15) http://docs.phaser.io/Particles.js.html#sunlight-1-line-15 is expecting the game instance and you are not sending it, try to do this: var MyParticle = function(game) { Phaser.Particle.call(this,game); this.size = null;};Regards
  2. If you really want to master JavaScript you need to read "The secrets of the JavaScript Ninja" by John Resig (the creator of jQuery), is the best book out there after reading that you will be able to learn any javascript library easily (including Phaser) http://www.amazon.es/Secrets-JavaScript-Ninja-John-Resig/dp/193398869X Regards
  3. It would be nice to add a class system like Ring ( http://ringjs.neoname.eu/), Joose (http://joose.it/) or any other like that. When using prototypes the code looks awful xD Regards
  4. Hi guys! Im having an issue when setting the x and y coordinates to my sprite, here's the thing: Im creating my main character in the create method as follow: me.player = new Hunter(me.game,30, me.game.world.height - 128);me.game.add.existing(me.player);me.game.camera.follow(me.player); The first time it works perfect, the hunter gets displayed in the correct coordinates, the camera is following the hunter as it moves in the world, however... after the hunter is dead I show a message to the user and a button to restart the level, when the user clicks/tab the button I execute this line of code to restart the level. this.game.state.start('play');This runs the shutdown method in my state to destroy the current elements, and then the create method is executed again, the hunter is created but instead of been displayed in x=30 and y=me.game.world.height - 128, the hunter is displayed whenever the camera is, it looks like the coordinates in the constructor of the sprite are relative to the camera and not to the world. Here's the code I have in the Hunter constructor class: var Hunter = function(game, x, y, frame) { var me = this; Phaser.Sprite.call(me, game, x, y, 'dude', frame);}Here's the link of the game, play a few times and look how the hunter is not been placed in the right coordinates. http://gorillas.aprendejs.com/ Maybe I'm doing something wrong? is there another way to set the coordinates to a sprite? I also tried this but didn't work: me.player = new Hunter(me.game,30, me.game.world.height - 128);me.player.body.x = 30;me.player.body.y = me.game.world.height - 128 //forcing coordinatesThank you so much for your help.
  5. Nice work, thank you for this, this definitely helps newbies like me. Just wondering, what are the differences with this one: https://github.com/codevinsky/generator-phaser-official Regards
  6. I think you should change the size of the body and leave the animation frames as they originally are, same with/height for all of them, Im not sure if you can change the size of the sprite for each animation. http://docs.phaser.io/Phaser.Physics.Arcade.Body.html#setSize Regards
  7. crysfel

    My first game

    Hi guys! Im really new to game development, after reading many tutorials, finding help in this forum, reading code in github and in the examples, I'm done with my first game!! http://gorillas.aprendejs.com/ I did a lot of refactoring with the code, but Im finally happy with the result, I know there are a lot of things to be improved but Im still learning Let me know what do you think. Regards
  8. @Eguneys, because that will distort the image, if you want to keep the same pixel size you need to do it in that way. This remains me the old days before CSS3 rounded corners exists
  9. You need to kill the correct bullet, remove line 241 and kill the bullet there. function p1Damage(player, bullet){ //destroyBullet() bullet.kill(); //<--- killing the currect bullet player2 +=1 p2ScoreText.text = 'Player2: ' + player2;}If you want to call the destroyBullet() method, you need to send the bullet you want to kill, otherwise you will get the global reference and you will kill the wrong bullet. destroyBullet(bullet);Regards
  10. Hi Gnumaru. I've been developing JavaScript apps for several years, and it's always a good idea to use several files and classes to create apps, having everything in a single file is a nightmare, there are many alternatives to load several files into your html automatically, however this is only great for development purposes in production environment is a really bad idea, for production environment you should always minify and compress your code in a single file, this way the loading will be a lot faster. There are also a lot of alternatives to concatenate and compress your javascript files, back in 2007 I did it manually but in 2014 there are many tools to do it automatically I personally use this Yeoman generator: https://github.com/codevinsky/generator-phaser-official is a really nice project that helps you to separate your code in different files and include them automatically for you, it uses grunt therefore creating the production version is as simple as runing this command in your terminal: $ grunt prod Regards
  11. Im using "phaser-official", it allows you to separate your states, also you can generate prefabs for your characters or whatever you need. https://github.com/codevinsky/generator-phaser-official It includes Browserify, grunt, a webserver and many more goodies. Good luck!
  12. Looks good, congrats! It would be nice if you add a loading bar or something when the assets are loading xD
  13. Hi almac. Not at all, is really easy if you already know JavaScript! Good luck!
  14. Yeah, phaser-official is great! is easy to create prefabs and states.
  15. Hi Guys! Im really new to games, this is my first attempt of creating a game and so far I've found Phaser a great library! There's one problem that I have, I want to create moving platforms, I found this example: http://jsfiddle.net/lewster32/4yh8ee1f/ which is great, however my map is larger and I would like to move the platforms in just some space not to the limits of my map. Is there a way to set limits to the moving platform? let's say from x=100 to x=400. Thanks in advance.