• Content Count

  • Joined

  • Last visited

About klesken

  • Rank

Contact Methods

  • Twitter
  1. Heya What is the easiest way to create invisible/visible rectangles that the player is to collide with(walls, etc)? I feel like I have to use Phasers built-in classes etc for performance, but I can't seem to find a good way to do it.
  2. FF steady 60 FPS. Chrome steady 30 FPS. IE steady 67 FPS. Safari steady 60, but the animation felt a bit weird.
  3. Is there a way to increase the size of what is shown in a tilemap/tilemaplayer? I'm currently trying to use several tilemaps next to eachother, but it just doesn't work. The problem is that for tilemaps bigger than the gamescreen if you set fixedToCamera=false, it becomes the size of the screen in place and weirdly scrolls within that smaller screen. I get that this is intended to create such effects that can be seen in the tutorials etc. But I can't seem to find what properties decides this. I've tried looking at source, changing camera/world/layers/maps etc. So I'm up for any tip etc. I guess you could have a variable keeping track of current tilemap and when it reaches a certain point it changes to another one. But that seems pretty annoying to implement and might not be the most efficient.
  4. Hello again! I've been working on this RPG-like game. And I'm using the program Tiled to create tilemaps to be used in-game. The problem is that I want it to be able to handle "dynamic" tilemaps, I want this so I don't have to have a 10000x10000 big tilemap but instead have several smaller ones. Keep in mind that this is the first time I'm using tilemaps and I'm thinking of them as big images with smaller images within them. With this I thought there was some way to place them next to eachother, but experimenting I haven't found it. There doesn't seem to be any property within the TIlemap-class that decides what x/y-values it should be drawn at. I've tried creating the maps and layers and then switching the camera.position. I've tried modifying the layer.cameraOffset, this places the tilemap with offset, but this screws up the camera and the bounds for the camera still doesn't change. game.world.camera.setBounds() doesn't seem to work when creating the tilemaps, even though I set it to be 10000x10000, I can't scroll beyond the size of the tilemap. And I've added another function to layers instead of using resizeWorld() I've tried this one: Phaser.TilemapLayer.prototype.resizeWorldSpecific = function (x,y,width,height) { this.game.world.setBounds(x, y, width, height);}But that doesn't work either. /*Tried setting bounds, size etc here */tileEngine.addMap('tilemap1');tileEngine.addTilesetImage('tilemap1', 'tileset_floor');tileEngine.addTilesetImage('tilemap1', 'tileset_wall');tileEngine.createLayer('tilemap1', 'Background');tileEngine.createLayer('tilemap1', 'Foreground');tileEngine.createLayer('tilemap1', 'Top');/*Here I've been trying to put everything I can think of to change the x/y values / width/height values */tileEngine.addMap('tilemap2');tileEngine.addTilesetImage('tilemap2', 'tileset_floor');tileEngine.addTilesetImage('tilemap2', 'tileset_wall');tileEngine.createLayer('tilemap2', 'Background');tileEngine.createLayer('tilemap2', 'Foreground');tileEngine.createLayer('tilemap2', 'Top');/*Tried setting bounds, size etc here */tileEngine is just an object which contains the maps / layers etc. In my mind this seems like it would be possible, am I wrong? Thanks in advance!
  5. Ah :s It doesn't stay forever in IE, it just delays a bit(like 1-2 seconds) but in Chrome and Firefox it stays as a hand.
  6. Heya I'm having this bug that makes it so after I remove/hide something that's clickable the "hand-cursor" becomes the active cursor forever. This code brings it on, I've tried looking at source code, and following the code it seems to change back, but it doesn't. function playCallback(button, pointer){ this.buttons.menuGroup.visible = false; }menuGroup is a Phaser.Group. Also wondering what's the "best" option if I want something like a menu to dissapear when the game starts, visible = false is what I'm using now. Is there something better? Thanks in advance!
  7. klesken

    Swapping images

    Thanks, that works great! I have another question, again this might be about javascript :|. I have my code down here, creating a deck of cards basically to be able to flip and such. cards.forEach(function(card){ card.flip(); card.reference.input.boundsRect = rectangle; card.reference.inputEnabled = true; card.reference.input.enableDrag(true); card.reference.input.bringToTop = true; card.reference.input.enableSnap(32, 32, false, true); card.reference.events.onInputDown.add(cardClicked, this); }); function cardClicked(){}function Card(ref, suite, value, frame){ this.reference = ref; this.suite = suite; this.value = value; this.frame = frame; this.showFace = true; this.flip = function(){ this.showFace = !this.showFace; if(this.showFace){ this.reference.frame = this.frame; } else{ this.reference.frame = 52; } }}cards is an array with Card-objects, in which the references are sprites. And basically I want it so that when I press a card it flips, but to do this I need its place in the array with reference as key(I could do a search, but if there's another way it would be great). I've also been thinking that in Javascript you can just add members to an object on the fly, but that doesn't seem to work for me when handling these sprites, I get members as undefined. So basically I'm wondering if I'm going about this the wrong way, or if there is something I can put inside cardClicked() to make it work.
  8. klesken

    Swapping images

    Hello I'm currently working on a simple memory game. I got it working, but I'm not content with how certain things are done in the code. For example, right now I'm using one sprite for the face up and one sprite for the face down of a card. With visible=false / visible=true. And since these are different sprites which are supposed to be at the same coordinates I have to update 2 things instead of 1. I've also tried using the loadTexture-function. But this removes the old texture and it loads it and reloads it etc, which works for small numbers, but what if I wanted a memory of the size 10000? In a "regular", language this would be as straight-forward as: if(faceUp){ image = face; } else image = back; But, since I'm new to Javascript and Phaser I might be missing something easy. So, is there a function within Phaser which does this, or should I try to look at the sourcecode and "ugly"-program it? Thanks in advance!
  9. Heya I just started using Phaser myself, this looks like a very good use of it Love the look and the gameplay is great. Memory and mouse-control!