jmp909

Members
  • Content Count

    432
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by jmp909

  1. try mySprite.baseTexture.skipRender=trueotherwise it uses the default texture for the sprite, which is generally the last texture used i think [update] actually that doesn't work ... skipRender here, just means both texture's dont show, presumably because they're actually sharing the same texture http://codepen.io/jmp909/pen/xZGVKy and just to confuse matters, this works now, but only because I've put 2 texture in the cache.. with 1 texture it breaks as you mention http://codepen.io/jmp909/pen/adONdQ i guess it's a bug then
  2. Cache should retain between states, that's what a preloader state is for!
  3. i think i was having a similar issue here http://www.html5gamedevs.com/topic/18106-replace-image-atlas-in-cache-with-bitmapdata/ can you not have a prior game state that puts everything in the cache, and then load it in the next game state? also I don't know if this is any use to you http://phaser.io/docs/2.4.4/Phaser.BitmapData.html#generateTexture generateTexture(key) → {PIXI.Texture}Creates a new Image element by converting this BitmapDatas canvas into a dataURL.The image is then stored in the image Cache using the key given. Finally a PIXI.Texture is created based on the image and returned.You can apply the texture to a sprite or any other supporting object by using either the key or the texture. First call generateTexture:var texture = bitmapdata.generateTexture('ball');Then you can either apply the texture to a sprite:game.add.sprite(0, 0, texture);or by using the string based key:game.add.sprite(0, 0, 'ball');
  4. are you trying to reveal more of the map but keep it at the same scale? you said "it does not show more map" so i assume so. you can use resize() i think but it says not to bind it to window resize event as it is expensive http://phaser.io/docs/2.4.4/Phaser.TilemapLayer.html#resize there's an example here http://phaser.io/examples/v2/tilemaps/resize-map resizeWorld makes the world the same size as the map, otherwise you'd only end up seeing eg one screen size of the map and it wouldn't scroll.
  5. i just meant a snippet of code you are using to make and store an image. eg I've done this before http://www.html5gamedevs.com/topic/5683-add-bitmapdata-to-cache-as-image/?p=99067
  6. you are given the option when you create a layer. also they have different icons
  7. nope, you can't use createLayer on an Object layer, it's only for Tile layers if you're using p2 you can use convertCollisionObjects https://www.mvcodeclub.com/lessons/creating-enemies-and-collisions-in-phaser-and-tiled var walls = game.physics.p2.convertCollisionObjects(map, "Collisions", true); for(var wall in walls) { walls[wall].setCollisionGroup(wallsCG); walls[wall].collides(playerCG); }
  8. can you share your code or make a version on sandbox? i'm not sure if it'll all work just using preload state
  9. Google don't provide that web font, I don't know why you're trying to use it via that.. they only give the fonts available here https://www.google.com/fonts also you need to refer to which browsers support which font types http://caniuse.com/#feat=woff2 https://css-tricks.com/snippets/css/using-font-face/ for Android you'll likely need .ttf then
  10. set user scale to devicePixelRatio? I've not tried it but something like.. scale = window.devicePixelRatiothis.game.scale.scaleMode=Phaser.ScaleManager.USER_SCALEthis.game.scale.setUserScale(scale, scale)//this.game.scale.setGameSize(375*scale, 667*scale)there's some discussion here too i think http://www.html5gamedevs.com/topic/1380-how-to-scale-entire-game-up/
  11. jmp909

    mask doesn't work

    I think mask may need to be of Phaser.Graphics type http://phaser.io/docs/2.4.4/Phaser.Group.html#mask try using alphaMask? Although I don't think that works on groups There's also this but it's old http://www.html5gamedevs.com/topic/1444-how-to-use-pixi-masking-in-phaser/
  12. did you remove your FPS meter from the Android version? if not, try removing it and using bitmap text to display your fps http://phaser.io/sandbox/BGpUHRyb/play
  13. Seems to be solved here... http://www.html5gamedevs.com/topic/11260-animations-wont-work-in-sprite-object/
  14. here's one way to do it using Sin/Cos http://phaser.io/sandbox/gXbgAMnK/play and another using phaser's point rotation function (with a distance constraint... http://phaser.io/docs/2.4.4/Phaser.Point.html#rotate) http://phaser.io/sandbox/wDpGcNHm/play I've taken 0 angle as the top of the circle, but that's not the normal way angles are measured so i've shifted the value accordingly I'll leave you a challenge... add acceleration/deceleration to the movement....
  15. you could try this maybe this.initAnimations().bind(this)not sure if it's right
  16. you've not added a layer yet in your create function var layer1 = map.createLayer('Tile Layer 1')layer1.resizeWorld()
  17. yes text is already noted as expensive (slow) for the reason mentioned above http://www.html5gamedevs.com/topic/2661-performance/?p=17515
  18. my bad.. scaling doesn't quite come out how i'd intended http://phaser.io/sandbox/jhtctOQP/play can you create a webfont out of the littera font? then you could pull it in as live text, apply the filters http://phaser.io/examples/v2/text/text-shadow-stroke and then cache the result as a bitmap (normal text is relatively slow, so not ideal for text that is present constantly) in your case though the double stroke is an issue as phaser won't support that directly... there are CSS tricks to do that but I'm not sure about the implementation https://www.petercarrero.com/examples/stroke/ note however you can use .generateTexture() to turn text into a bitmap texture http://phaser.io/sandbox/mbcxSXJl/play ps i don't think filters work in Canvas mode, only WebGL mode. might need a different approach depending
  19. Have a language selector and only load/cache the images you need.... Regenerate if language is changed
  20. No, I mean is it eg a score where the digits update constantly or is it a static word? If the latter then create the whole thing as a dynamic bitmap at game startup time using those techniques, stick it in the cache and then pull it out of the cache as required
  21. When do you need to display the text and how often does it need to update?
  22. Probably wrong context for "this". Put ,this) At the end of your .add http://phaser.io/docs/2.4.4/Phaser.Signal.html#add
  23. You could render your word to a texture/BitmapData, process pixels on the BitmapData to make a white silhouette of your word and scale it slightly bigger, then insert it behind the original word. Look here for how I made a sillhouette http://www.html5gamedevs.com/topic/18256-masking-a-sprite-with-a-complex-shaped-image/ for the dropshadow I guess you could make a black copy and add the available blurX/blurY filters. Maybe there's an outline filter, but I haven't looked when I get back to my PC tomorrow I'll try and do an example
  24. Thats wrong this.selectorGroup.alpha = 0; that would just set the group alpha to 0, not the children's alpha either use setAll or forEach