Jump to content

Search the Community

Showing results for tags 'PhysicsEditor'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 7 results

  1. Hello, I am trying to imitate a rotating part (a.k.a. "windmill" please see this youtube video) using the Matter physics engine's constraint. I have tested a body shape made with PhysicsEditor and that of simple image shape (just a thin rectangle). The windmill made with PhysicsEditor keeps on rotating and it does not seem to stop until you give another collision to the body. Here is a codepen to demonstrate. https://codepen.io/BeFiveINFO/pen/EdQgdq Please try pressing space key for a second. Is there any way to control the behaviour of the body shape made with PhysicsEditor? Thank you for your help in advance!
  2. Hi All, The body.gameObject is null during collisionstart event when using TexturePacker and PhysicsEditor json files Cannot read property 'setTint' of null The setTint call works (and gameObject is valid) when I load the two images directly like this.load.image('ship', 'images/ship.png'); Do I need to modify this code in some way so I can use TexturePacker and PhysicsEditor? var config = { type: Phaser.AUTO, width: 800, height: 600, parent: 'phaser-game', physics: { default: 'matter', matter: { debug: true, gravity: { y: 0 } } }, scene: { preload: preload, create: create } }; var game = new Phaser.Game(config); var ship; var ball; function preload() { // Load sprite sheet generated with TexturePacker this.load.atlas('sheet', 'images/sprite-sheet.png', 'images/sprite-sheet.json'); // Load body shapes from JSON file generated using PhysicsEditor this.load.json('shapes', 'images/sprite-shapes.json'); } function create() { this.matter.world.setBounds(0, 0, game.config.width, game.config.height, 0, false, false, false, false); var shapes = this.cache.json.get('shapes'); ship = this.matter.add.sprite(0, 300, 'sheet', 'ship', { shape: shapes.ship }); ball = this.matter.add.sprite(600, 300, 'sheet', 'ball', { shape: shapes.ball }); ship.setVelocityX(10); this.matter.world.on('collisionstart', function (event) { console.log("collisionstart"); console.log(event.pairs.length); console.log(event.pairs[0].bodyA); console.log(event.pairs[0].bodyB); event.pairs[0].bodyA.gameObject.setTint(0xff0000); // gameObject is null here (Cannot read property 'setTint' of null) event.pairs[0].bodyB.gameObject.setTint(0x00ff00); // gameObject is null here (Cannot read property 'setTint' of null) }); } sprite-shapes.json sprite-sheet.json
  3. 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 labs.phaser.io. 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 Image.data.onload (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
  4. I have a sprite sheet of my games playable character. The frames consist of all possible actions the character can do, including two different attacks. I want to change the physics bounds on different animations as my sprites positioning obviously changes with different animations. I got PhysicsEditor expecting it could handle this but as far as I can see, it only works for single images. Is there any solutions for this to help me get near pixel perfect collision? Any help is appreciated as always
  5. Hi guys, I just wrote a small plugin that enables loading a JSON file generated with PhysicsEditor directly in Panda.js+P2 physics engine. The main goal of this project is to facilitate the process and to provide an efficient the workflow to make great games in Panda.js: You can find the download on Github here: https://github.com/stephan0v/PhysicsEditor-plugin Have a look at the live demo in Panda fiddler here: http://vermeire.home.xs4all.nl/panda/ Requirements: Panda.js frameworkP2 plugin for panda.jsA working version of PhysicsEditor (https://www.codeandweb.com/physicseditor). Instructions: Firstly you have to import the custom exporter into PhysicsEditor. This enables the program to export the physics settings of your choice in a workable JSON notation. Copy the exporter folder in this repository to your local harddrive and link the program to it (see: https://www.codeandweb.com/physicseditor/documentation, at the bottom of the page). Import your personal images in PhysicsEditor and create all the settings you need in second. (Have a look at some of the great tutorials here: https://www.codeandweb.com/physicseditor/tutorials).Export the settings you just generated with the custom exporter Panda-p2 (JSON).Import the JSON in Panda like so:game.module( 'game.main').require( 'plugins.p2', 'plugins.pe_loader').body(function() { game.addAsset('banana.png'); game.addAsset('physics.json'); /* this file is a JSON that looks like this: { "banana": { "mass": 2, "gravityScale": 1, "damping": 0, "angularDamping": 0, "shapes": [ { "type": "POLYGON", "collisionGroup": 1, "collisionMask": 65535, "polygon": [ [98, -0.5] , [106, 0.5] , ...... ] } ] } , ... } */ game.createScene('Main', { backgroundColor: 0xe1d4a7, init: function() { physics = game.getJSON('physics.json'); //Create world this.world = new game.World({gravity: [0, 5]}); this.world.ratio = 100; //now add some fruit var fruit = new game.P2Sprite('banana.png', physics.banana, game.system.width/2, game.system.height/2); fruit .addTo(this.stage); }); });Enjoy!
  6. Many link to this: https://www.codeandweb.com/physicseditor on posts relating to obtaining p2 physics collision json. Is there any other software that can obtain the json that is free?
  7. Hey I'm trying to find a tool that will let me export the correct style JSON to add to a sprite using the .setPolygon() method. I've tried all the export settings from PhysicsEditor and none seem to provide the correct JSON. Is this the best tool to be used to create points from a shape with a transparent background? The polygon itself is quite complex, consisting of around 400 points. I wonder if it's even possible with this many points?
×
×
  • Create New...