Search the Community
Showing results for tags 'colission'.
-
Hi everyone, I am new to Phaser framework and it's great! I have made a lot of progress on this Street Fighter game I am doing. A little background of my problem: I have my code set up that when I press W (Medium Punch), I increase the width of the sprite by via setRectangle playerKen.body.setRectangle(70, 80, -18); once I expanded the hitbox , I play the sprite, then set the width back to its original size once the animation has finished playing: kenAnimation = playerKen.animations.play('standingMediumPunch', 10, false).onComplete.add(function () { //reset the graphics back playerKen.body.setRectangle(35, 80, -18); playerKen.body.setCollisionGroup(kenCollisionGroup); playerKen.body.collides(mBisonCollisionGroup, hitEnemy, this); kenAttacking = false; playerKen.body.velocity.x = 0; playerKen.animations.play('standing', 7, true); playerKen.body.static = false; //console.log('punching'); }, this); I have also programmed the AI too, won't get into that. But my issue is the overlapping hitboxes. See the attached photo... When a situation like this occurs when I am punching and the AI is punching as well, the health of the player and the AI does not decrease. I looked into https://phaser.io/examples/v2/sprites/overlap-without-physics but the getBounds() method only gets the width of the sprite, not the hitbox. How can I see whether the two hitboxes have intersected? By the way, I am using p2 physics. Thanks a bunch!
-
Hello guys! I must mention that I am new, and that I am Latin, so sorry for my English. Okay.. my question is the following. How to collision normal image and polygonal image.? What a clash with each other. In short, that's what I need to know. I hope you can help me, thank you all!.
- 10 replies
-
- normal images
- poliygonal images
-
(and 2 more)
Tagged with:
-
Since the default camera collision behavior is kind of awkward (camera 'glues' to any surface it bumps into until manually 'released'), I resorted to just try to prevent the camera from going underground, so to speak, with just moving its target upwards as much as the camera would otherwise be underground. http://www.babylonjs-playground.com/#1OWKH4 However the camera will start to flickr from going underground in one frame to being corrected in the next frame. More noticeable on lower FPS. How to prevent this? Thanks in advance
-
Dear community, I am trying to move my player object towards my mouse and am trying to achieve that if the player colllides with a group of sprites (stars) that the star in the group of stars is deleted. The thing is, I only want this to happen if the player entirely covers the star. Both stars and players use the P2JS physics. I wonder if this is needed. So I have 2 problems now. First I used arcade and i could easily move my player with the mouse. How can I do this in p2JS? Since Im now using p2JS because of circle colliders, how can i check if another circle (star) is within the larger circle (the player)?