• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Massemassimo

  1. I really think there is no reason not to use typescript.
  2. Yes, arcade definitely still has some issues in that department! But afaik you can use p2 with phaser, so you don't need to switch everything, just the physics.
  3. Yes, my floors are all static and the player is moving only through changes of velocity. Still the same problem occurs.
  4. Ok seems I get no general coding advice. If somebody can point me to a video or tutorial on how to code in a clever fashion, I would be very thankful. Anyways, closing this since the correct answer was given earlier.
  5. No general programming advice?
  6. Ok this worked! I had tried it before starting this post, but ran into troubles since I just tried to add the overlay object and the map object as a whole to their groups, which threw a runtime error since A Group is a container for display objects including Sprites and Images. (Phaser docs -> group), and the overlay and the map object are no display objects. The way I do it though feels a little clunky to say the least, could anybody elaborate on if you would've structured your code differently? As an example, at the moment I pass the following stuff to my map object on creation: constructor(overlay: Overlay, game: Phaser.Game, grp: Phaser.Group, tileHeight: number, tileWidth: number, tilesX: number, tilesY: number)The overlay pointer gets passed to each tile which takes args like so constructor(overlay: Overlay, game: Phaser.Game, x: number, y: number, key: any, coords: Phaser.Point)and calls the overlays function drawTileCoors like so this.overlay.drawTileCoords(this);drawTileCoords looks like this: drawTileCoords(tile: Curious.Tile) { this.textQ.position.set( - 30, + 30); this.textR.position.set( + 30, + 30); this.textQ.setText("q:" + tile.coords.x); this.textR.setText("r:" + tile.coords.y); }the textQ and textR objects are Phaser.Text objects created in the overlay constructor and added to the overlay group passed to the overlay object as an arg on creation / initialization (?term?). Is this clunky or what? Sure feels like it.
  7. @valueerror yes, the problem was adressed, but for me, updating didn't solve the problem.
  8. Hey, I am trying to reorder my objects but I am having a hard time (I am a very inexperienced programmer in general). So... Not sure if the following is important, but I will very briefly explain what I want to do and how I am trying to do it, maybe you can turn this into a lesson while (hopefully) answering the main question. What I want to do: Draw a map consisting of hexagonal tiles (extending sprites)Show some data about each tile when being hovered (text should be on or close to the tile)How I go about it: create an overlay object controlling the infocreate a map object which in return creates the tile objectslisten to hover events on each tile (did this with, this); and if (this.input.checkPointerOver(, false)) { this.hoverOver(); }, seems to do the same)call a function of the overlay object called "drawTileCoords(this)" in the "this.hoverOver". function of the tile objectsNow hovering over the tiles works just fine (I also do "this.tint = 0xBADA55;" in thisHover(), which does tint the hovered tile). Also having the overlay.drawTileCoords(tile: Tile) function write stuff about the received tile pointer (like tile.position.x) to the console is no problem. In the constructor of the overlay object I set var style = { font: "12px Arial", fill: "#000000", align: "center" };this.textQ =, 0, "a", style);this.textR =, 0, "b", style);which should work just fine, right? In the drawTileCoords function I do this: this.textQ.position.set( - 30, + 30);this.textR.position.set( + 30, + 30);this.textQ.setText("q:" + tile.coords.x);this.textR.setText("r:" + tile.coords.y);and the text changes (checked with console.log(this.textQ.text);) but I never see the text being rendered. Now I believe this is because I create the overlay object first and then the map object (which then creates the tile objects), leading to the tiles being rendered after/over the overlay. This is part of my main Phaser.State's create function : this.overlay = new Overlay(; = new Map(this.overlay,, 52, 64, 20, 10);So my questions are: Am I right with this assumtion?If I am in fact right, what can I do about it? How do I get the overlay to render after the map?If I am not right, what is going on?Also, is this the normal way of having objects talk to each other or would you do it completely different? I really do not know what I am doing, only learning from examples and as I go.
  9. Have the same problem, no solution yet (other than to make a top down game )
  10. Or typescript, like this: export class MonsterBunny extends Phaser.Sprite {rotateSpeed: number;constructor(game: Phaser.Game, x: number, y: number, rotateSpeed: number) { super(game, x, y); this.rotateSpeed = rotateSpeed;}update() { this.angle += this.rotateSpeed;}}
  11. Maybe I am an idiot but isn't inheritance a feature of Typescript / vanilla javascript, not Phaser?
  12. Less than 30 lines of code per game. Wow. oO
  13. Same problem here, have been looking for a solution for a few days now, but nothing helps. Really frustrating.
  14. Would you mind setting spencerTLs answer as the "best answer" so everyone can see the solution at a glance? Or did he send you code as a PM?
  15. Yeah, I wasn't quite sure what it did but it didn't render more FPS. Learned that today and was very confused for a while since changing the game.time.desiredFPS didn't chance game.time.fps.So as far as I can see the name "desiredFPS" is a bit misleading, FPS usually being the amount of frames drawn per second (hence the name ), not the amount of update loops. P.S.: maybe a bit of a funny story: Since I wanted to up physics calculations per second, I set desiredFPS to 120 and tried my best to handcode some sort of slowing mechanism for the FPS through locking framerendering for a certain amount of frames (half of them at desiredFPS = 120) by toggling game.lockRender true/false. Later of course it turned out that all of this was useless since phaser already handles that.
  16. One game per book (why bundle them? I see no downside to single game books if they are digital only)Those games could be bundled later for a bigger, print-worthy book.Detailed explanations why something was done the way it is - maybe even hints on how features could've been implemented differentlyMaybe book 1 for beginners, 2 for intermediate, 3 for beginners again and so on (no expert books since those probably don't need 'em?). Also happy new year to you, too! Awesome job you're doing!
  17. For others coming here with the same problem: Solution can be found here:
  18. I am also interested. My problem is that since the arcade (or any other physics engine included in phaser) engine does not support continuous collision detection, which leads to objects falling through each other sometimes (most notably the player falling through the floor). My reasoning is that if I update the game logic to update more often, it will check for collisions more often, hopefully stopping the collision-problem. Is that wrong? Edit: Ok, I actually AM wrong. The above method (game.update(200) does execute the update function more often (not sure what really happens, nothing but 0.). The problem for me is that it does not only run MY update code, but all of it, including drawing the sprites - just everything. FPS go way up. So for me, that's not really what I was looking for, since I just wanted to have more frequent collision detection. *sigh*
  19. Hey, since my platformer (no tiles) has troubles with the player falling through the floor sometimes (pretty high gravity, FPS at 60). Since Rich said "the logic and rendering are now fully decoupled" (here), I wonder if and how I can up the amount of loops per second the game logic is trying to run for. Also I'd like to know if there's a shortcut for having phaser show me the amount of loops per second like it is possible with the FPS or if I would need to handcode that. Of course, any other ideas or constructive comments helping with the problem are welcome, too.
  20. You're definitely not alone with this. I experience the same thing with high gravity and 60fps. I will try upping the FPS tomorrow. Another thread like this:
  21. True, and I don't know how to fix it. Somebody suggested changing body.mass for the player and the floor but that doesn't help in my case. Other solutions work with setting arcade.TILE_BIAS to 40 (sometimes different numbers), which isn't helpful for me since I don't use the included tile system. Very annoying for me, considering changing to p2 (though somebody said that none of the physics engines included in phaser support continuous collision detection and therefore all have this problem. You COULD try and implement box2d or another continuous collision detection physics engine, of course... :/ What rich said in November '14 (here) : This lets me hope it will be built into phaser later (and I hope "later" is "sooner" )
  22. Hey, sorry to dig this out but I wonder what you would call that construct containing the wasd referrals. (Also sorry for the poor phrasing.) "Array" comes to my unschooled mind, but it obviously is no array. Edit: My genius brain thought of checking what "game.input.keyboard.createCursorKeys()" returns - so it's just an object, right? Damn, I know nothing (though my name is not Jon Snow).