Search the Community

Showing results for tags 'shape'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 20 results

  1. Hello, The answers to my questions may seem evident, please consider I'm a complete beginner to HTML and JS Phaser coding. I am having two problems with my code. The first is that renderTexture doesn't seem to work. I am trying to make a trail of my player, like the "trail" example on I actually copied the code needed, but it does not work. Here is the line causing the problem: rt = this.make.renderTexture({ x: 0, y: 0, width: 800, height: 800 }).setOrigin(0, 0); in the create function. And here is what the console says: Uncaught TypeError: this.make.renderTexture is not a function at Scene.create ((index):301) at SceneManager.create (phaser.js:51412) at SceneManager.loadComplete (phaser.js:51329) at LoaderPlugin.emit (phaser.js:2622) at LoaderPlugin.processComplete (phaser.js:111210) at LoaderPlugin.removeFromQueue (phaser.js:111190) at LoaderPlugin.processUpdate (phaser.js:111171) at (phaser.js:8947) _____________ The second issue affects the collision boxes of my obstacles. Those are static sprites, and the physics are "MatterJS". I have defined the shape of the hitboxes in PhysicsEditor, and have done exactly like in their tutorial to link the JSON to the sprites, but it doesn't work: the collision is not only triggered when the player enters the parts in the shape, but also in the rest of the rectangle that should not be considered. Furthermore, all physical properties I've set in the editor don't work. Then, I tried to do all of it without physicsEditor: I added required setters to do the work. While the physical properties are now correct, the hitboxes are still the whole rectangles instead of the chosen parts. Here is the code: //example var ob12 = this.matter.add.sprite(800-211, -6353, 'ob12').setStatic(true).setSensor(true).setFriction(0,0,0).setInteractive(new Phaser.Geom.Polygon([ [ { "x":132, "y":291 }, { "x":337, "y":498 }, { "x":423, "y":2 } ], [ { "x":50, "y":789 }, { "x":239, "y":979 }, { "x":337, "y":498 } ], [ { "x":0, "y":1220 }, { "x":423, "y":1639 }, { "x":239, "y":979 } ], [ { "x":239, "y":979 }, { "x":423, "y":1639 }, { "x":337, "y":498 } ], [ { "x":337, "y":498 }, { "x":423, "y":1639 }, { "x":423, "y":2 } ] ]), Phaser.Geom.Polygon.Contains); Thank you, Vainly
  2. I need to create a project based on a flash project, however, I can't think of a way to replicate this: I was thinking about using graphics but I do not know how to update it when dragging. Is there anyway to create this?
  3. I'm building a tile based game, and I'm generating a lot of tiles with drawShape and polygon data and then adding them all to a container. Every tile is generated. Right now if I go larger than about 150 x 150 the app crashes with a webGL failure. Do I need to convert these to sprites or something else? Any suggestions? Also, even though there are many tiles there are a much smaller amount of variations, is there a way to copy and reuse already generated tiles? I might want to change the colour so they can't be of the same instance.
  4. Art Vandelay

    Shape of light source

    Hi, I couldn't seem to find an answer to this question I want to create a light source that has a specific shape, or make an object also be a light source. Whichever. How would I do that? Thanks for the help!
  5. Hi Everyone, I need guidance on how can I approach this problem: Would like to apply a tiled texture to complex polygons. I'm using P2 for the physics and tiled for the level editor. I would like to get something similar to worms where the terrain has a tiled texture, the top has grass and the bottom is darker. These are some examples of what I would like to achieve: I don't care at all about destructible terrain. This is how my level looks now with polygons from tiled:
  6. Hi, I am not able to get the normals on an extruded surface right. In this playground try clicking on the extruded shape. The normals on the cap are right. But the normals on the side faces are irregular. Also the reflection of light on the surface is a bit weird. Probably wrong uv. Any ideas on how to fix this? I want to have the normals and the light reflection behave like it would do on a regular cube created with Mesh.CreateBox Thanks
  7. Datamosh

    Resize or change shape

    Hello! I need to change/adjust the collision rectangle when the entity crouches. I guess that I need to use addShape and setShape but I do not understand how to do it. Can anybody help me with an example or snippet? Thanks!
  8. Wnitsch

    Center shape after rotation

    I'm creating triangles using Phaser.Graphics.drawTriangle. Then I'm rotating the shape by the center point (width/2, height/2). After that I want to place triangles side by side, but, after the rotation the height and width may change, so I recalculate this and get a new center point. But the shapes are not very well placed. How to place it right? There is another way to center the shapes? In attchament I generated the same triangle side by side rotating then 45°. The red dot and the lines are only for reference where they would be. Thanks in advance,
  9. Does anyone know if it is possible to customize the physics shape of specific tiles in a tilemap, for example use a circle shape or polygon instead of the typical rectangle? This would be really nice, as it would enable using atypical shapes for wall/platform terminators and make the map look much more stylish. If there is no out-of-the-box feature, what would be a good way to accomplish this? I am, of course, using the P2 physics system.
  10. andersthorborg

    P2 physics semi circle body

    Hi there, I am new to phaser and to test it out I am recreating the old SlimeSoccer Java-browser-game. ( I've implemented it with P2 physics and generally it is working pretty well. However I am having a difficulty with making the body of the "players" behave properly when colliding with the ball. So far I haven't found a way to create the semi circlular shape with phaser/P2? Is it correct that this is not possible - that it is either a full circle or a polygon? I have created a polygon with a lot of points to "simulate" the circular shape, but it doesn't work as intended. I've tried actually making circular bodies to test the physics and that works great, except they should be "cut in half". Does anyone have a clue to how to approach this? Thanks! Anders
  11. Hi! I am new here and to pixi.js and game development in general and I wanted to know if it is it possible to subtract a graphics shape from another shape using pixi.js? I know it is possible using canvas' "globalCompositeOperation" with "destination-out" or "source-out" like is demonstrated here: but I wanted to know if it is supported by webgl as well and if there's an already built method in pixi.js for it. if such a method does not exist yet, what would be the best way to implement it? thank you for your time.
  12. Hey everyone, I've making a game with various enemies that are made from balls with various abilities. I'd like one of them to grow and shrink over time, and I'm using the P2 physics module. Changing the size of the displayed sprite is easy with sprite.scale.x/y but I'm not sure what the equivalent command is to update the sprite.shape which is used by the physics engine. So when I scale it, I end up with a large sprite but the original hit box. What is the correct way to handle this? Is it necessary to remove and recreate the shape each time I resize my object? -MoragX
  13. hyude

    Need help for some problem

    Hello. I need some idea to implement feature in my game. 1. When player gain score, I want the gained score to be added gradually, so the animation will look smoother. I have the idea to use Phaser Tween class for this. However, the tween process results in the score being a floating number when in process. Is there any way to use implement this so it only tween integer value? I know I can manually use timer for this, but it seems costly, and might create many trash object afterwards. 2. Does Phaser have a Shape-object which can act like sprite? For example a rectangle, circle, or triangle which can be rotated, scaled, moved, tweened as easily as sprite does. I need those shape to achieve a circular status bar. Thank you.
  14. culeaalex

    Draw custom shape Mesh

    For the last 2 full days I am trying to make a function to draw a custom shape mesh and I can't do it. I am trying to fill it with triangles (as I understand it is done), but my math skills and logic are not good for this. Plus the function I made doesn't fill it correctly and loads the browser (and RAM) very much to the point that it crushes the browser for low memory (after long time usage ~ 1 hour ). It is driving me crazy, and I saw that is on the road-map, but I desperately need it for the current project I am working at, this being the only thing that is stopping me to advance. PS: I do not intent (for now) to use curved lines in the custom shapes.
  15. culeaalex

    U/L/Custom shape plane

    Hello, I want to create houses in babylon and for that i need to create custom shaped floors (ex: L shaped houses) that I will be able to apply texture to and make it look uninterrupted. How do I do this? ( I have no experience with 3D terms so sorry if there is another topic like this).
  16. Hello, The loadPolygon method doesnt change when the shape of animation changes. var ship = game.add.sprite(200, 200, 'player'); ship.animations.add('fly', [0,1,2,3], 10, true);'fly'); game.physics.p2.enable(ship, true); ship.body.clearShapes(); ship.body.loadPolygon('physicsData', 'suu'); ship.body.fixedRotation = true; The loadPolygon is the same. How can i change the shape and the loadPolygon the same time?
  17. if this is even possible how do i accomplish this? thx in advance!
  18. BigRob154

    Rendering Shapes (Circles)

    I just stumbled over "Hundreds" ( iOS / Android Puzzle game ) and tried to find a way to render Circles with Phaser. There is an example for rendering a circle with debug graphics, but it get's drawn last, so I can't really include the score / weight inside the circle. What's the best way, if there is any currently, to draw Circles vector-like in Phaser? Do you have some directions for me here? Thx a lot Attached code: App.Game.prototype = { create: function() { for (var i = 0; i < 10; i++) { var x = Math.random() *, y = Math.random() *, d = 20; var circle = new Phaser.Circle(x, y, d); var text =, y, '' + 0, { font: "25px Arial", fill: "#ff0044", align: "center" }); text.anchor.set(0.5); this.objects.push({ circle: circle, color: 0x999999, value: 0 }); } }, render: function() { for (var i = 0; i < this.objects.length; i++) { var o = this.objects[i];, o.color, true); } }};
  19. turjuque

    Performance issue and groups.

    Hi there! I'm porting AncientBeast to Phaser but i'm facing some problems. First of all, it seems that the rescale function of Phaser do not scale the rendered area as it remains at the start resolution (it's scaled after rendering). Is it right? I think it does have an impact on performance. Secondly it seems impossible to have nested groups with transforms. Speaking of groups, is it possible to group shapes like sprites? Finally my main performance issue : I only have a background sprite with 139 hexagons sprites on top and 2 creatures and it's already laggy. Is it because the renderer is set to 1920*1080? I was considering doing the hexagons with shapes but they seem to be less flexible. Any idea on how to proceed?
  20. Hello! I'm founder of - we're indie game developers working on an open source browser based TBS www.AncientBeast.comWe're considering adopting a game/rendering engine in order to make the game more playable on tablets and phones The gameplay coder has a question: Also, what's the state of documentation? Would rather see that instead of almost daily change log xD So far Phaser looks awesome, I really dig the website :-)