• Content Count

  • Joined

  • Last visited

About vernonr

  • Rank
  • Birthday 07/26/1985

Profile Information

  • Gender
  • Location
    Buenos Aires
  • Interests
    Music, literature and video games!
  1. Hello again. New problems arise everyday! I have a character who has an animation called "hit". Here's the strip of frames. So in my code I have this little something that makes the character "hit" when the btnGolpe is down: btnGolpe = game.input.keyboard.addKey(Phaser.Keyboard.M); in function update (): else if (btnGolpe.isDown) {'golpe'); } The problems? 1) The animation keeps looping if btnGolpe is down. It should only play once per button pressing. 2) I need that the character actually "hits" it's opponent with his fist. Is there a way to do this? The collision should be between the fist and the opponent. Bare in mind that the fist is shown in one frame of the whole animation, so it show only register the collision in that frame, in that position (the fist, in this case). I'm really looking forward for your advise on these things. Thanks in advance, people!
  2. My friend, you are saving my days! Will try this right away!
  3. Hi, good people! I encountered a new problem while coding my first game. First, let me explain what I have so far. It's a fighting game. I have my two characters on screen: player1 and player2. They move alright. They both have some movements in common (like moving around, jumping and ducking) and some movements of their own (a combination of keys will trigger a special move of some sort). Among other things, I have this in my code: var player; var player1; In function create() : player = game.add.sprite(18, 200, 'ciro'); player2 = game.add.sprite(618, 200, 'damian'); Finally, in function update() I have the movements of each of these characters. So what's the problem? I also have other characters in mind, with individual sprites, animations and moves (and they will share the basic moves, as well). My idea is to have a roster of fighters from where player1 and player2 will choose one each and then, in a stage randomly picked, fight each other. You know how it goes. How can player1 and player2 "choose" a character? Should I set the characters, with the sprites, animations and special moves in some sort of class or separate file and then, add the chosen one to either player1 or player2? I'm guessing I need some sort of variable there but I know almost nothing about javascript :s Help! I'm clueless!
  4. Thanks a lot! Your code has been really helpful but I finally ended up using a JS library called mousetrap. It allows combinations of keys to be used. It works for now so I'll think I'll stick in my code. I still have to solve my problem number two, though
  5. Ok, so I was checking the forum and I found this idea about how to get a double tap action. Think that I could use it with a combination of keys for what I need to do. Here's the idea: You could do 2 things: 1. Always have a short delay on keyup. e.g. keyup -> check if timer active, if yes -> cancel timer and emit charge forward, if no -> timer = setTimeout(normaltap, 100); <- or whatever delay 2. check last tap time keyup -> check if difference between time and last time you pressed the key is less than 100 ms (or whatever delay you prefer) if yes, set the time to 0 and emit charge forward (0 so that the next keyup wont trigger another double tap if you mash the key too fast) if no, emit normaltap and save the current time for this key The thing is that I don't know how to do this. Any ideas? Thanks!
  6. Many thanks! I'm looking but there's nothing phaser oriented. I know that to many of you it would be easy to translate an idea from one code to another but for me is very difficult. I'll keep looking but if someone around here could give me a hint as from where to begin the resolution of these issues, that would be the greatest
  7. Hi guys, I'm really new to Phaser and programing in general so I'm getting stuck really often with my first game. What I'm trying to do is some sort of a two players fighting game (this is a game for gamepads and keyboards, no mobile here). I kinda have the basics going, I mean, my characters move! But i have a list of things to do that keeps growing! Here I have my first two problems for you, kind people: Problem number 1: The thing I'm trying to do is to have my character perform a special move with a combination of buttons. I'm guessing there should be a timer involved somehow. The idea is that if you press button 1 and quickly press button 2 and 3, a special move will happen (a set of frames of my animation sheet) but if you don't press them fast enough, then you will have the animations for each instead (button 1 is used for punching, button 2 is used for kicking and button 3 for blocking). Problem number 2: How can the punch o the kick hit player 2? I have the two sprits on screen, each of them are moving but they don't hit each other. I would need to have some sort of lifemeter or something, one for each player, and a value for punching, kicking and any other special move, which will affect the lifemeter of the player being hit. Many thanks in advance! I love this Phaser engine and the community in this forum. I'm really excited with this game