hexus

Members
  • Content count

    46
  • Joined

  • Last visited

About hexus

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Twitter
    hex72

Recent Profile Visitors

462 profile views
  1. plugin

    If you only need rectangular physics bodies to collide with slopes on a single, non-offset tilemap, then yes. However, consult the roadmap for features I'm intending to implement. While circular physics bodies have been implemented, there is still a really strange issue where it teleports the body after catching between square tiles. Not being able to solve this problem put me off working on the plugin for a while.
  2. Slightly questionable using world.player like that, it doesn't take into account the asynchronous nature of Node. It'd be safer just to use an object pool.
  3. this.game.slopes.convertTilemapLayer is the converter, perhaps that's not clear enough in the readme. You just map the index of each tile to one of the available tile shape types. I don't have a handy wiki for people to look up these constants with their corresponding shapes though. I would suggest using a Tiled map instead, and using an invisible collision layer that uses the ninja physics tilesheet and mapping. Then your graphical tiles aren't tied to the collision tiles.
  4. Which makes sense. How do you scale 1.32546 of a pixel without anti-aliasing?
  5. Yeah, as Lewster said, the largest the device can support will be the best. Less to send to the GPU and potentially less draw calls needed. http://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/ I've always found articles like this enlightening. For Doom, they throw everything into these mega textures! iD have done it that way for ages, apparently.
  6. Here's your fixed game state. There were a number of bugs to begin with, particularly the fact that your CSV tilemap doesn't have layers, so you just need to pass 0 instead of 'collision'. Also, because your tilesheet doesn't have the same layout as the Ninja Physics debug tilesheet, the mappings of course wouldn't work, so I estimated a mapping for your current tilesheet. The JavaScript should be all you need to change. Happy coding! /** * Created by Welcome on 03/10/2016. */ var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { this.game.load.tilemap('tilemap', 'assets/tilemaps/csv/tiles.csv', null, Phaser.Tilemap.CSV); this.game.load.spritesheet('tiles', 'assets/tilemaps/tiles/snow_tiles_32.png', 32,32); this.game.load.spritesheet('player', 'assets/penguin.png', 32,48); } var cursors; //var snowballs; //var sTime = 0; //var fireButton; function create() { this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.plugins.add(Phaser.Plugin.ArcadeSlopes); cursors = game.input.keyboard.createCursorKeys(); this.map = this.game.add.tilemap('tilemap'); this.map.addTilesetImage('snow_tiles_32', 'tiles'); this.game.stage.backgroundColor = '#80e3ff'; this.ground = this.map.createLayer(0); this.ground.resizeWorld(); this.game.slopes.convertTilemapLayer(this.ground,{ 1: 'FULL', 2: 'FULL', 3: 'FULL', 4: 'FULL', 5: 'FULL', 6: 'FULL', 7: 'FULL', 8: 'FULL', 9: 'HALF_TOP', 10: 'FULL', 12: 'FULL', 13: 'HALF_BOTTOM_LEFT', 14: 'HALF_BOTTOM_RIGHT', }); this.map.setCollisionBetween(1, 34, true, 0); //player this.player = this.game.add.sprite(100, 50, 'player'); this.game.physics.arcade.enable(this.player); this.player.body.slopes = {sat: {response: 0}}; // workaround for a phaser bug this.game.slopes.enable(this.player); this.player.body.slopes.preferY = true; // stops the player sliding down slopes this.player.body.bounce.y = 0.2; this.player.body.gravity.y = 2000; this.player.body.collideWorldBounds = true; this.player.animations.add('left', [0,1,2,3], 10, true); this.player.animations.add('right', [5,6,7,8], 10, true); //this.snowballs = game.add.group(); //this.snowballs.enableBody = true; //this.snowballs.physicsBodyType = Phaser.Physics.ARCADE; //this.snowballs.createMultiple(1, 'snowball'); //this.snowballs.setAll('anchor.x', 0.5); //this.snowballs.setAll('anchor.y', 1); //this.snowballs.setAll('outOfBoundsKill', true); //this.snowballs.setAll('checkWorldBounds', true); //this.fireButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); this.game.slopes.enable(this.player); this.game.camera.follow(this.player); } function update() { this.game.physics.arcade.collide(this.player, this.ground); this.player.body.velocity.x = 0; if(cursors.left.isDown){ this.player.body.velocity.x = -150; this.player.animations.play('left'); } else if (cursors.right.isDown){ this.player.body.velocity.x = 150; this.player.animations.play('right'); } else{ this.player.animations.stop(); this.player.frame = 4; } if(cursors.up.isDown && (this.player.body.onFloor() || this.player.body.touching.down)){ this.player.body.velocity.y = -350; } //if(fireButton.isDown){ //this.fireSnowball(); //} //} //function fireSnowball(){ //if(game.time.now > sTime){ //this.snowball = snowballs.getFirstExists(false); //if(snowball){ // this.snowball.reset(player.x+30, player.y+30); //this.snowball.body.velocity.x = 400; //this.sTime = game.time.now = 10; // } //} }
  7. plugin

    Yes, it supports tiles of any size. I started building a tilesheet generator a while back, so that it'd be easy to grab an image that works with the plugin immediately, but I haven't put the time in to finish it yet.
  8. I agree that it could definitely be a more intuitive, but it didn't take me too long to work it out.
  9. plugin

    Finally sorted the issue that was driving me mad. That feel when one kind of tile has its vertexes defined counter-clockwise instead of clockwise... Version 0.2.0-alpha has been released with initial support for circular physics bodies. It still freaks out on some of the smallest tiles and sometimes on corners of tiles, but it's a good start. Also, many thanks to IkonOne for the new typescript definitions.
  10. Not sure if it's right to post issues on GitHub for the dev branch, so I'll mention some issues I'm having here. Applying a filter to game.world complains that a TilemapLayerGL instance doesn't have a getBounds method. It should have one, right? But I've noticed in the source it doesn't. Also, losing DOM focus on the game breaks camera follow for me, resetting camera position to the top left of the map. It seems like it causes the game world to resize too, as my player sprite can suddenly collide with all edges of the screen. Edit: This was caused by some bugs that I've fixed as part of a pull request. Is there any way to switch back to the canvas renderer in WebGL mode? Edit: It does work well as a drop-in replacement for the Arcade Slopes demo, just not my more complex, full screen project. I'm actually going to tinker with the Phaser source and see if I can fix anything.
  11. plugin

    I've already started work on it, but it's proving trickier than expected. I'll definitely update everyone here when it's sorted.
  12. It's possible with the regular particle system for sure. I would assume that particle storm works similarly, but maybe not. http://phaser.io/examples/v2/particles/when-particles-collide
  13. Use this. I've started a project with it and it's a fantastic starting point. Starting to heavily modify the gulpfile though, might have to start modularising it!
  14. I'd like to expand on this for speed hacking, too. You could use a lenient range check on the player to make sure, according to their allowed speed, whether they're moving too quickly. You won't want to be too strict with this though, because latency will most definitely cause some inconsistencies.