kieve

Members
  • Content Count

    8
  • Joined

  • Last visited

About kieve

  • Rank
    Newbie
  • Birthday 04/05/1993

Profile Information

  • Gender
    Male
  • Location
    Canada, Ontario

Recent Profile Visitors

605 profile views
  1. Unfortunately, you can't do much in 2D, but you can animate the player.scale.x between -1 and 1. See this fiddle: https://jsfiddle.net/g0b5wftg/
  2. I updated my post with a more comprehensive solution.
  3. You double posted, but I'll reply to this one: Working fiddle: https://jsfiddle.net/hshL1x96/ Timers default "autoDestroy" to true. When you call "stop()" on the timer, it gets destroyed. You need to add the timer event again. Thus, you also need to update the "onDown" context. Simply change like so: timer = game.time.create(false);...game.input.onDown.add(this.restart, this);...restart: function () { timer.stop() timerEvent = timer.add(Phaser.Timer.SECOND * 1, this.endTimer, this); timer.start();}
  4. Haha, yeah sorry. It's late. I updated with the link like 20 seconds before your post
  5. Hey guys. I decided to write a tutorial on how to build maps in Tiled and use them in Phaser. The main focus is using many Tiled maps in a single Phaser map. This makes creating content much easier as you don't have to do much world building in code. This is my first tutorial, so if anyone does read it I would love any feedback. Feel free to ask any questions here as well. I use Phaser 2.3.0 dev in this tutorial, as it exposes the "type" properties in Tile maps. It covers building two Tiled maps, a world and a house to put in that world. This includes moving Tilemaps around and getting collision working. It creates a basis for a topdown rpg game, feel free to use it. Warning: It's pretty long You can find the tutorial at http://www.kieve.ca/ For a demo of what I build in the tutorial, visit http://www.kieve.ca/demos/RPG/ You can download the project here: http://www.kieve.ca/demos/RPG.zip
  6. Hey, I actually ran into a similar problem not long ago, see my post http://www.html5gamedevs.com/topic/13117-how-to-position-multiple-tilemaps/ I've managed to create multiple tile maps and moved them around. I haven't tried to use the collision layers, because my collision "elements" were smaller than a single tile. Instead, I make use of an object layer that represents all the locations where walls will be, with custom width and height properties. It can be done.
  7. I ended up figuring this out. Kind of annoying but the following works fine: layer.fixedToCamera = false;layer.scrollFactorX = 0;layer.scrollFactorY = 0;layer.position.set(pixelX, pixelY);You have to do this on every layer in the tilemap.
  8. Hi, I'm trying to make use of several tilemaps to build the world, cities, and dungeons of my game. For example, having a single tile map represent the "layout" of the outdoors of a city; leaving spaces or "lots" for buildings to be placed. These buildings would each contain 5+ layers, every building needs their layers to be mutually exclusive of the others. The base layouts of areas are rather large (150x150 tiles) compared to the buildings (13x8 tiles). I want to be able to reuse the buildings, so I'm not going to copy and paste them around a map created in Tiled. When the player walks into a building, I want to fade out the external look of the building, and fade in the interior. When you have 10, 15, 20+ buildings in one level, it becomes very difficult to manage the large amount of layers in a single tilemap. Not to mention I have no idea how it would perform with 100 layers, each at 150x150x32x32 pixels. What I need is to be able to move one tilemap relative to another. I need to change the origin of a tilemap. I've spent a few hours searching this forum and google looking for an answer. Even if I can't make of collision on the layers, I can sort that out easily once I'm able to move the tilemaps around. So, here is an example of what I have now. Code notes: home_village_f0 - A 150x150 tile map that gives the layout of a city house0_f0 - A 13x8 tile map that represents a house. TPOW.States.Game = function(game) {};TPOW.States.Game.prototype = { create : function() { // Load the current over world map this.home_village_f0 = this.game.add.tilemap('home_village_f0'); this.home_village_f0.addTilesetImage('city_inside', 'tiles_city_inside'); this.home_village_f0.addTilesetImage('forest_tiles', 'tiles_forest_tiles'); this.home_village_f0.addTilesetImage('PathAndObjects_0', 'tiles_PathAndObjects_0'); this.ground = this.home_village_f0.createLayer('ground'); // Resize the game world to match the layer dimensions this.ground.resizeWorld(); // Load each module // TODO: Auto load modules based on map content this.house0_f0 = this.game.add.tilemap('house0_f0'); this.house0_f0.addTilesetImage('city_outside', 'tiles_city_outside'); this.house0_f0.addTilesetImage('interior', 'tiles_interior'); this.house0_f0.addTilesetImage('hyptosis_tile-art-batch-3', 'tiles_hyptosis_tile-art-batch-3'); this.house0_f0.addTilesetImage('base_out_atlas', 'tiles_base_out_atlas'); this.house0_floor = this.house0_f0.createLayer('floor'); this.house0_indoors0 = this.house0_f0.createLayer('indoors0'); this.house0_indoors1 = this.house0_f0.createLayer('indoors1'); this.house0_outdoors0 = this.house0_f0.createLayer('outdoors0'); this.house0_outdoors1 = this.house0_f0.createLayer('outdoors1'); // Test this.house0_floor.alpha = 0; this.house0_indoors0.alpha = 0; this.house0_indoors1.alpha = 0; /** * More content not relevant to question. */ }, update : function() { var alpha = this.house0_floor.alpha; if (alpha != 1) { alpha = Math.min(1, alpha + 0.005); } this.house0_floor.alpha = alpha; this.house0_indoors0.alpha = alpha; this.house0_indoors1.alpha = alpha; this.house0_outdoors0.alpha = 1 - alpha; this.house0_outdoors1.alpha = 1 - alpha; /** * More content not relevant to question. */ }};TL;DR: How do I move a tilemap relative to another? That is, make the top left corner be something other than (0, 0) in the world.