Massemassimo

Members
  • Content count

    64
  • Joined

  • Last visited

  • Days Won

    1

Massemassimo last won the day on March 22 2014

Massemassimo had the most liked content!

About Massemassimo

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    @chgeese

Recent Profile Visitors

549 profile views
  1. New to Phaser and Visual Studio question

    I really think there is no reason not to use typescript.
  2. Platformer player sometimes passing through platforms

    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. Moving platform falling

    Yes, my floors are all static and the player is moving only through changes of velocity. Still the same problem occurs.
  4. Rendering Order

    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. Rendering Order

    No general programming advice?
  6. Rendering Order

    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(tile.center.x - 30, tile.center.y + 30); this.textR.position.set(tile.center.x + 30, tile.center.y + 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. Platformer player sometimes passing through platforms

    @valueerror yes, the problem was adressed, but for me, updating didn't solve the problem.
  8. Rendering Order

    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.events.onInputOver.add(this.hoverOver, this); and if (this.input.checkPointerOver(this.game.input.mousePointer, 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 = this.game.add.text(0, 0, "a", style);this.textR = this.game.add.text(0, 0, "b", style);which should work just fine, right? In the drawTileCoords function I do this: this.textQ.position.set(tile.center.x - 30, tile.center.y + 30);this.textR.position.set(tile.center.x + 30, tile.center.y + 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(this.game);this.map = new Map(this.overlay, this.game, 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. Platformer player sometimes passing through platforms

    Have the same problem, no solution yet (other than to make a top down game )
  10. How to write a class that extends from Phaser.Sprite?

    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. Object Inherintance in Phaser?

    Maybe I am an idiot but isn't inheritance a feature of Typescript / vanilla javascript, not Phaser?
  12. The Phaser Book of Games

    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. know the exact x and y coordinates of each item of a group

    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. Fastforward button

    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.