• Content Count

  • Joined

  • Last visited

About entiendoNull

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. entiendoNull

    Drawing Offset

    Hello there! I've got a question regarding the "Drawing Offset" that the Tiled mapeditor has. In short, does Phaser supports it? The map that I am using has several layers. The general size of a tile is 32x32px, but some sprites are twice as big. Even though it looks good in "Tiled" I noticed that the positions of my "trees" below had moved when I run the game. I've been trying to track the Tiled property "tileoffset" down... and thought it might be located in the Phaser.Tileset object within the drawCoords array. But, that does not seem to the trick..? I've attached a few images below to illustrate what I mean. Edit: Just read that Phaser v. 2.7.5 might have this feature implemented. Will be trying in a few hours. I will get back with the results of that test in case others have similar issues in future. Tiled Mapeditor Tileset settings Within Tiled Mapeditor When the game has rendered In my Tiled JSON file I've got the following: { "columns":1, "firstgid":41, "image":"..\/sprites\/tree.gif", "imageheight":64, "imagewidth":64, "margin":0, "name":"tree", "spacing":0, "tilecount":1, "tileheight":64, "tileoffset": { "x":-32, "y":0 }, "tilewidth":64 } Any help or clarification is much appriciated. Best regards!
  2. entiendoNull

    Camera Zoom to Mouse Pointer

    @valueerror, hey there. I know this thread is quite old, but I'll give it a shot anyway. Is there a simple way to implement zoom and move (using two fingers) at once? Desired effect can be found on google maps today. Thanks in advance,
  3. entiendoNull

    Tilemap zoom in and out

    Sorry to be replying to my own question. But hopefully, we'll get this sorted and it can help others with similar problems. I've found this simulating the exact zoom effect that I'm after. I've actually been able to play around with it and had most of my original ideas from the first post solved by it. However, it does use an old version of Phaser (2.2.2) http://jsfiddle.net/pdx0px0w/ When I upgrade to Phaser 2.6.2 the behaviour becomes very different. http://jsfiddle.net/pdx0px0w/86/ I suspect it has with the following piece of code to do: if (prevScale.x != nextScale.x || prevScale.y != nextScale.y) { var scaleAdjustX = nextScale.x / prevScale.x; var scaleAdjustY = nextScale.y / prevScale.y; var focusX = (game.camera.position.x * scaleAdjustX) + xAdjust * (rescalefactorx); var focusY = (game.camera.position.y * scaleAdjustY) + yAdjust * (rescalefactory); game.camera.focusOnXY(focusX, focusY); } Any ideas on how to get this to work on Phaser 2.6.2 as well? Do anyone uses the code in the fiddles?
  4. entiendoNull

    Tilemap zoom in and out

    Hey there, I've ran into an issue which I really can't get my head around. I've made a tilemap in Tiled and I've successfully rendered it with Phaser. I can move the map around using arrow keys and mouse and the next I wanted to do is to add a zoom in and zoom out feature (and that's where I'm lost). In the first screenshot the tilemap is shown 100%. The pink area is just a filled polygon that I mapped out in Tiled. In other words, it doesn't fill any purpose for what I'm trying to accomplish with the zoom what so ever. In the second screenshot I've changed the view to 50%. My intention is to make the map zoom out, but still use the entire canvas. Right now, I see the same piece of map as in screenshot 1. Just smaller. I wish to see more of the map. How can this be accomplished? Any help and/or advice is much appriciated. Here's what I've got. var game = new Phaser.Game(800, 600, Phaser.WebGL, 'my-map', { preload: preload, create: create, update : update, render : render }); function preload() { game.load.tilemap('mymap', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('My Map', 'assets/vala_map.jpg'); } var map; var layer; var cursors; function create() { game.stage.backgroundColor = '#787878'; map = game.add.tilemap('mymap'); map.addTilesetImage('My Map', 'My Map'); layer = map.createLayer('mymap'); layer.resizeWorld(); cursors = game.input.keyboard.createCursorKeys(); poly = new Phaser.Polygon(map.objects.storelayer[4].polyline); graphics = game.add.graphics(map.objects.storelayer[4].x, map.objects.storelayer[4].y); graphics.alpha = 0.2; graphics.beginFill(0xFF33ff); graphics.drawPolygon(poly.points); graphics.endFill(); } function update() { if(this.game.input.activePointer.isDown) { if (this.game.origDragPoint) { // move the camera by the amount the mouse has moved since last update this.game.camera.x += this.game.origDragPoint.x - this.game.input.activePointer.position.x; this.game.camera.y += this.game.origDragPoint.y - this.game.input.activePointer.position.y; } // set new drag origin to current position this.game.origDragPoint = this.game.input.activePointer.position.clone(); } else { this.game.origDragPoint = null; } //this.game.world.scale.setTo(0.5, 0.5); // zoom if (game.input.keyboard.isDown(Phaser.Keyboard.Q)) { this.game.world.scale.setTo(1, 1); } else if (game.input.keyboard.isDown(Phaser.Keyboard.A)) { this.game.world.scale.setTo(0.5, 0.5); } if(cursors.up.isDown){ game.camera.y -= 4; } else if(cursors.down.isDown){ game.camera.y += 4; } if(cursors.left.isDown){ game.camera.x -= 4; } else if(cursors.right.isDown){ game.camera.x += 4; } } function render() { game.debug.cameraInfo(game.camera, 32, 32); } Regards, entiendoNull
  5. entiendoNull

    Different floor levels

    Thanks for your reply, and wow! That really does look like Ultima 7. Okay, that makes sense. I will try to experiment a bit with all this considering your input. Thanks a bunch
  6. entiendoNull

    Different floor levels

    Hi there, I have recently developed an urge to make a game... and I found Phaser - which is an incredible project! I am not new to programming, but am mainly a PHP programmer. I've programmed quite a lot in JavaScript too... but mainly things that are website related - never games. I figured I wanted to create a small tile based MMORPG as a hobby project. Mainly to pick up some new programming skills. I've found quite a few of those projects that are up and running and they look great. One thing that crossed my mind though is that everything seems to be built flat on the tilemap in those games. Below follows some examples to visualize what I mean. Say, a house with several stories are often built like this: The two story house is built on one floor. The attached image files comes from a game i found called Tibia. It is also a tile based game, but with a little bit different perspective. In the first screenshot it's shown how the house looks when the character is placed a few tiles away. It shows a two story house. In the second screenshot it's shown how the house look when the character is placed next to the house. In the third screenshot it's shown what that the house looks like when standing next to the house on the second floor. I'm posting in hope to get some advice on how to achieve something like this? What is the best practise here? I've been considering several canvases and several "maps" defining the different floor levels, but was hoping for a more elegant solution. I've seen that the popular "Tiled" editor got support for layers, but I haven't found anything about actual floor levels. Does this option exist in "Tiled"? Thanks in advance!