Jump to content

m4d3

Members
  • Posts

    5
  • Joined

  • Last visited

m4d3's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. i cant seem to fix this. btw. you dont have to call resizeWorld() for each of your layers if your map stays the same size.
  2. yes, the camera follow works, i tried disabling everything and moved the camera with the cursors like in this example, and the tilemap still disappears, when im not moving the camera everything is fine. http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=csv+map.js&t=csv%20map Im using a Tilemap JSON File generated by Tiled btw. Simple code: var map = this.game.add.tilemap('level1');map.addTilesetImage('Level_1', 'tiles'); var layer = map.createLayer('Layer1');layer.resizeWorld();
  3. mh, the problem doesn't seem to be the physics. the tilemap just disappears when the camera is moved (it's a FOLLOW_TOPDOWN cam).
  4. I'm using a updated dev build (build with grunt) and my tilemap still disappears after the first p2 physics collision. I have a seperate collision mesh for the ground and the tilemap is just for visual represantation so i dont wont it to collide with anything and just stay in place. Doesnt work for me so far no matter what im trying.
  5. Hi, i was playing around with Phaser, making a little Platformer style game, but i cant get the ground collision right. Either its working like intended but the animation doesnt trigger or my sprite falls through the ground and other objects. Here is what my class looks like: class Player extends Phaser.Sprite { game: Phaser.Game; isJumping: bool; constructor(game: Phaser.Game) { super(game) this.game = game; //this = Game.createSprite(Game.stage.width * .5 - 50, 200, "player"); this.x = game.stage.width * .5 - 50; this.y = game.stage.height - 150; this.loadGraphic("player"); this.acceleration.y = 980; this.drag.x = 900; //player.drag.y = 500; this.maxVelocity.x = 250; this.maxVelocity.y = 250; this.animations.add('run'); this.animations.play('run', 10, true); this.isJumping = true; } public update() { var keyboard: Phaser.Keyboard = this.game.input.keyboard; // Jumping YAY! if (keyboard.isDown(Phaser.Keyboard.UP) && !this.isJumping && this.velocity.y === 0) { this.velocity.y = -300; this.acceleration.y -= 300; this.isJumping = true; } // Check for Ground Contact if (this.isTouching(Phaser.Collision.DOWN)) { // Stop Forces in Y this.acceleration.y = 0; this.velocity.y = 0; this.isJumping = false; if (Math.abs(this.velocity.x) != 0) { this.animations.play('run'); } else { this.animations.stop("run"); } } else { // if Jumping, apply Gravity this.acceleration.y += 50; this.animations.stop("run"); } } } Could someone tell me whats wrong? In my main update() routine i check for collision: function update() {Game.collide(playerGroup, collisionGroup, collides);}I tried a lot of different aproaches but none did work like intended. Help would be really apprecheated!
×
×
  • Create New...