samid737

Members
  • Content count

    273
  • Joined

  • Last visited

  • Days Won

    1

samid737 last won the day on April 18

samid737 had the most liked content!

3 Followers

About samid737

  • Rank
    Advanced Member
  • Birthday February 12

Contact Methods

  • Website URL
    https://github.com/samid737/

Profile Information

  • Gender
    Male
  • Location
    The Netherlands

Recent Profile Visitors

1,436 profile views
  1. Swap Characters

    There are different ways to achieve this. You can keep some track of some counter, have A list of sprites and use loadTexture to swap trough the list of sprites. If you want more flexibility, here is an example using custom classes: The idea is to extend phaser group A little bit by adding a swap function. The swap function then switches characters (not just the texture, the entire object). In the example the group is moved troughout the world, but you could just as well move each Character object individually (Character.prototype. update instead of Characters.prototype.update). The example is adapted from A character selection snippet I made once: You might be able to combine the two examples if you need some character selection screen/UI.
  2. Physics with touch to move player

    This post is related: P2 is sophisticated enough I think. You could try arcade physics, but rotational effects are not considered after collision, so the ball will not spin when colliding with walls (it will in P2, see above post). Arcade physics bodies are always axis aligned, which might be undesirable in your case: p2: arcade: https://codepen.io/Samid737/pen/BRKdWK
  3. There are different ways to move the ball when pressing the sprite. This example is one way, but you can use moveToPointer (should work for p2), accelerate it to some point, you can apply A force or set the velocity/acceleration directly. Maybe you can try changing the physics properties of the ball/wall to get the desired result: damping, friction, restitution . Updated the example A bit:
  4. I have no clue about how the json exactly works so I can't help you with that, but I created the above via this tool. It automatically traces the transparent edges: https://loonride.com/tools/physics It should look like this:
  5. What does your physics body look like? Normally you would build the polygon as inverted (the red area/channel should not be drawn in the physics editor), then its just A matter of manipulating gravity via input, which could be the mouse, gyroscope (mobile): spiral.json The spiral (red is transparant in the example)
  6. Phaser P2 DebugBody - Visualizing Rotation (possible bug)

    Actually Canvas api even has A rotate feature: https://www.w3schools.com/tags/canvas_rotate.asp https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/rotate That could work for the old case. I am not near A pc so I cant test it...
  7. Phaser P2 DebugBody - Visualizing Rotation (possible bug)

    #258 still A bug, the workaround, more specifically, try if this works for drawRectangle : drawRectangle: function(g, x, y, angle, w, h, color, fillColor, lineWidth) { if (lineWidth === undefined) { lineWidth = 1; } if (color === undefined) { color = 0x000000; } c = Math.cos(angle); s = Math.sin(-angle); var oxc = w / 2 * c; var oxs = w / 2 * s; var oyc = h / 2 * c; var oys = h / 2 * s; g.lineStyle(lineWidth, color, 1); g.beginFill(fillColor); g.moveTo(x + (oxc - oys), y + (-oxs - oyc)); g.lineTo(x - (- oxc - oys), y - (oxs - oyc)); g.lineTo(x + (- oxc + oys), y + (oxs + oyc)); g.lineTo(x - (oxc + oys), y - (- oxs + oyc)); },
  8. Short questions about stba.io

    As @Skeptron said, the shadows can make it look 3D. I didn't notice the sprite size not changing , but adjusting the scale could add an extra height effect. the shadow could be A duplicate sprite (black tint, alpha <1) attached as A child, or it could be A custom lighting system.
  9. Adding function launchGreenEnemy() does not work

    What is the exact problem? If the enemies don't show up its probably because the enemy is always reset whenever it is spawned. checkWorldBounds is true and it is spawned outside world bounds. In the tutorial the green ship sprite is large enough so when it is reset/spawned to y = -20 A very tiny bit is still inside the game world. try changing the y value to A lower number (if you have small enemy sprites): enemy.reset(game.rnd.integerInRange(0, game.width), -3);
  10. Drag sprite from anywhere?

    If you're targeting one sprite, A simple speed check might do the trick:
  11. P2 sprite collision group pain

    Ironically, I introduced the bug. The complete story #279, The underlying problem is yet to be resolved, but its not A critical one. This was an unexpected bug as you can see. The Phaser-CE community does its best to foresee and are pretty busy maintaining, but quality control is definitely an added challenge with community driven projects.
  12. P2 sprite collision group pain

    #366 try updating to latest phaser
  13. Mouse position always zero

    Hard to tell without looking at the code. Can you provide more details?
  14. Animated Sin Wave

    You can try phase shifting the sine wave if that helps : Another way, which is probably less costly would be to make A tileSprite from the bitmapData and move the tilePosition.x. The amplitude will have to be fixed though.
  15. Can't get collision working

    A couple of things noticeable: -Your using images instead of sprites. - Adding physics to group objects can be done by using game.add.physicsGroup(), enabling them on each body individually or by ysing enableBody, but not by enabling physics on the group: //you can do this laserBoundaries = this.add.group(); laserBoundaries.enableBody = true; //or the above in one line laserBoundaries = this.add.physicsGroup(); //but this won't have any effect. game.physics.enable(laserBoundaries, Phaser.Physics.ARCADE); var laser1 = game.add.sprite(650, 273, 'laser');//change to sprite var laser2 = game.add.sprite(650, 0, 'laser2');//change to sprite var laser3 = game.add.sprite(470, 0, 'laser2');//change to sprite var laser4 = game.add.sprite(72, 273, 'laser');//change to sprite - collisionHandler is called, but it is never defined (the global variable is not required, you have defined it within your state object). try calling the right function: console.log(collisionHandler); //will show undefined console.log(this.collisionHandler);//will show the correct one game.physics.arcade.overlap(user, laserBoundaries,this.collisionHandler); //this will work