omediadon

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. I have already made a couple of games using Arcade, p2 is great for my next game (i would love to use box2d, but it's paid) I made other games using cocosd-x+box2d and libgdx at the time, that was greate but i like phaser more because it's concentrated and flexible. So i'm not new to phaser, nor game dev (both native and html5)
  2. Still nothing seems to work! Using your code (which was one of my tries already) does not help, I resized my sprite (1000*400) and inserted it at (0,0) without scaling, and with it! The best result i get is the "street" sprite filling the available space (600, not 1000), seems good enough for a start! But, whenever i enable p2 physics (with/without body shape) the sprite gets shrunk and misplaced again!
  3. Hi I am facing a problem, a little one that made doubt myself! I am inserting a sprite, which is 1000px width (it's a placeholder for bigger ones in production version) It's inserted but shrunk! Here's My code Booting up: var game; window.onload = function() { game = new Phaser.Game(1000, 400, Phaser.AUTO); // Add the States your game has. game.state.add("Boot", Boot); game.state.add("Menu", Menu); game.state.add("Preload", Preload); game.state.add("Level", Level); // Now start the Boot state. game.state.start("Boot"); }; Boot.prototype.init = function() { this.input.maxPointers = 1; // Setup the scale strategy game.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT; //OR ANY OTHER ScaleManager game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; }; My level: /** * Level state. * Started already! */ function Level() { Phaser.State.call(this); } /** @type Phaser.State */ var proto = Object.create(Phaser.State); Level.prototype = proto; Level.prototype.create = function() { //Resizing the World to fit the Sprite inside it! game.world.setBounds(0, 0, 1000, 400); game.camera.setSize(100, game.world.height); //Does not work too game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.restitution = 0.1; game.physics.p2.gravity = 1400; this.addStreet(); this.addObstacles(); }; Level.prototype.update = function() { move_camera_by_pointer(game.input.mousePointer); move_camera_by_pointer(game.input.pointer1); }; Level.prototype.addStreet = function() { // add the "the road" this.street = this.add.sprite(0, 400, "street"); //Added at the bottom left, but it doesn't work either this.street.anchor.set(0, 0); //Bodies are not my problem, it works nicely this.game.physics.p2.enable(this.street, true); this.street.body.kinematic = true; this.street.body.loadPolygon("streetps", null); //For debugging this.street.inputEnabled = true; this.street.input.enableDrag(true); }; Level.prototype.quitGame = function() { this.game.state.start("Menu"); }; //For debugging function move_camera_by_pointer(o_pointer) { if (!o_pointer.timeDown) { return; } if (o_pointer.isDown && !o_pointer.targetObject) { if (o_mcamera) { game.camera.x += o_mcamera.x - o_pointer.position.x; game.camera.y += o_mcamera.y - o_pointer.position.y; } o_mcamera = o_pointer.position.clone(); } if (o_pointer.isUp) { o_mcamera = null; } } That code results in Video_2016-08-24_004305.wmv And this is my "street" image (actually the name is a place holder too and i kept it)
  4. Hey My question is pretty straigh forward, is there any alternative to PhysicsEditor, that is at least Free if not OpenSource. Thanks in advance!
  5. Hey there So, this is my first post in here, i hope everybody is good out there, let's go straight into the issue. I'm new to Phaser.io, and I'm intending to use it to create a hill climber clone. I have successfully create car like shapes (following a couple of online tutos) but still very confused about how to create the land on which the car will run. To make it clearer, here's an illustration of what i exactly want: So basically, the original game introduces 2+ types of ground, that are the bridges, land, water, ... I need to implement only two types. I know how to "materialize" the body and everything that should go after i declare them, which is my problem. On Phaser.io examples page there's quiet half the solution to my problem but uses Box2D which is paid (and i can afford it right now, else, i would love to get it!)