matquango

Members
  • Content Count

    7
  • Joined

  • Last visited

About matquango

  • Rank
    Newbie

Contact Methods

  • Website URL
    http://quangoinc.com

Profile Information

  • Gender
    Male
  • Location
    Portland, OR
  1. KoalaForce, I was having the same problem in my game. I found that using the TilemapLayer resize function solved my problem with the tilemap layer being "cropped" on zoom. As the docs mention, it should be used sparingly as it's an expensive request, but I only call it when the user activates zooming rather than on an update cycle. I haven't noticed any noticeable lag from it, yet. If anyone else knows of a less expensive solution to this problem I'd love to know about it! handleZoom: function(zoomDirection) { if (zoomDirection > 0) { this.zoomScale += this.zoomScaleIncrement; } else if (zoomDirection < 0) { this.zoomScale -= this.zoomScaleIncrement; } this.zoomScale = Phaser.Math.clamp(this.zoomScale,this.zoomScaleMin,this.zoomScaleMax); // Set world zoom (this is a group I have sprites in that will need to be scaled) this.zoomGroup.scale.set(this.zoomScale); // Zoom background layer & resize this.backgroundLayer.scale.set(this.zoomScale); this.backgroundLayer.resize(this.game.scale.width,this.game.scale.height); // My game area scales so I use the ScaleManager to get the actual canvas dimensions to resize the background to // Adjust body size of scaled sprites this.playerCharacter.setBodyScale(this.zoomScale); this.triggerGroup.forEach(function(trigger) { trigger.setBodyScale(this.zoomScale); },this) },
  2. Yeah, this is essentially what I ended up doing. Luckily, I'm not getting the same collision problems as the example you posted. It's not pretty (especially as I continue to add objects since I'm scaling for zoom functionality), but it works!
  3. I'm having the same issue. I have a parent group that contains sprite objects with arcade physics bodies enabled on them. When I set the parent group scale, the sprite scale correctly, but their bodies remain at the size they were at creation. Anyone found any solutions?
  4. I recently got the opportunity to develop 2 separate HTML5 games in Phaser for a client training project and wanted to share the results of that here. Please keep in mind that these are intended more as fun, interactive training modules than fully fledged games and the target audience is 40-50yr old tech resellers. Each game is intended to be played through in about 10 minutes by someone who may or may not have experience with games in general. The games are intended to be played on Desktop (Though I added some hacky, last-minute touch support for Game 1: Space Evaders). Game 1: Space Evaders Space Evaders is a topdown, scrolling shoot em up style game. There are 3 "sections" and a boss battle at the end. This uses standard Arcade Physics with some extra polygonal collision detection. I created my own looping "map" system and level editor since it seemed like it fell slightly outside the realm of what Tiled could provide me. Game 1 Link: http://serversrock.intel.com/supply-run/level/1 Game 2: Martian Mayhem Martian Mayhem is a top down game where you collect cargo packages and avoid meteors, robots and falling into pits. Two level sections with the last one ending in a boss battle. It uses P2 physics (mainly for more precise collision detection) with many object bodies acting as sensors/triggers. I used Tiled to generate the levels for this game. Game 2 Link: http://serversrock.intel.com/supply-run/level/2 This was my first experience working with Phaser and I had a great time doing it! Many thanks to the Phaser creators and all the members here for the vast amount of information that exists on these forums!
  5. In case anyone was curious on my solution I ended up solving it using the following method: I created an objects layer in tiled for pits which are defined as polygons. I also created a "pit hole" layer which is a tile layer that contains tiles that cover the inner areas of the defined polygon pits as best possible. When there is a P2 collision between the player and the pit polygon, I have the player enter a "flail state." If the player needs to fall into the pit, I first get the tile the player is standing on and then check the adjacent tiles (in order of closes to current player facing) looking for any tile that is a "pit hole" tile. Once found, I have the payer fall towards the center of this tile which is easily calculated by tile position and tile dimensions. Since this calculation is only performed once before each "falling", the extra map performance is negligible.
  6. Hey all! So i've been working on a topdown style game using the P2 physics system. I've really enjoyed working with Arcade physics, but needed to switch to P2 to utilize polygon body shapes and polyline world collision maps. I'm trying to implement a "pit" object and currently have things working as I'd like (collision-wise) with the player in the following setup: - The pit is an object with a polygonal body I define in tiled and import into the game. - The pit body shapes are set as sensors to disable default P2 collision behavior. - When the player contacts the "pit" shape its velocities are stopped and it enters a flail state on the edge of contact. - If the players flail timer runs out it will fall into the pit. What I'm having trouble with is figuring out how to determine the correct angle for the player to fall (into the pit) once the flail timer runs out. The player has 8 way movement and the pits are generally laid out as polygonal shapes with right angles. I looked around the boards and found talk of getting the centers of mass for the objects and calculate the vector angle between them and thought this might work, but can't seem to find a way to make it happen. I thought if I could get some point where the bodies/shapes collided I could jut calculate the angle between the player origin and the collision point, but can't find any way to actually get this point. Is this data available? Am I going about this completely wrong?
  7. I'm currently using pixi to build an animated navigation menu for a website i'm working on. For the sake of example, imagine a bunch of clickable squares with images in a grid like layout. I've added some "responsiveness" javascript code to the menu to shift items depending on the browser window width as well. It's much like having a lot of floated content that will transition from a grid into a single column at smaller widths. When a user resizes and hits one of these breakpoints I call a resize to the Pixi renderer which in turn resizes the canvas (using renderer.resize(w,h) ) after reflowing content. For most cases, this works perfectly fine. I've noticed, though that when I use the WebGL renderer (I'm using autoDetectRenderer to take advantage of gpu throttling) the displayed content starts offsetting and scaling when the renderer resize is setting a height greater than 4000. The hitAreas and interaction seem to be correct, but all my menu icons are in the wrong position. Through testing, I've noticed that the displayed contents perceived y position decreases (moves up and off of the canvas) as the WebGL renderers height is increased passed 4000 until I can't see the content at all. Strange thing is that this doesn't happen in the regular CanvasRenderer. Any thoughts as to what's going on here?