• Content Count

  • Joined

  • Last visited

Posts posted by onefatman

  1. i know this is old as hell but did anyone ever work out how to get a touch event on a sprite in cocoon js? I can implemene a scaling offset on generic touch events but not sure how that affects events directly attached to sprites, etc . . .


    my code:

    this.playButton = this.add.sprite(140, 403, 'titlepage');this.playButton.inputEnabled = true;, this);

  2. Ok so a lot of this has been covered but here's my two cents:

    • Scaling support: most of the issues I've had are all stemming from the game not being able to be displayed properly on different devices/browsers etc. Coming from a flash background there was a "noScale" property that let the movie container scale to the browser window but kept all of the contents of the movie independent so you could handle all of the scaling within your project and nothing would stretch or leave any gaps. Not sure if it's possible with the canvas, if not maybe some sort of Phaser-specific renderer (similar to Ejecta for Impact) that could take care of it?
    • Native UI components
    • Better integration with Cocoon.js (or whatever wrapper suits best)
    • Box 2D, no need for 3D either
    • An easy way to hook up to greensock's animation goodies
    • multiplayer/network support
    • An easy way to create container sprite/objects, add children to them and still support the object as a single physics body. I built a workaround by not passing an id to a sprite, adding children and then overriding the physics bodies with the parent body, but it still had issues

    With all that said, even without all this stuff your product is amazing and is giving an old irreelevant flash developer a new lease on coding life. Keep up the rad work, and can't wait to see what you have in store!

  3. Hey all,


    I've got a cartoony dinosaur character sprite with a custom poly body that i've created in PhysicsEditor that has a large head at the top-left and a small body/legs at the bottom-right. It's P2 physics-enabled with a fixed rotation so it doesn't fall over, it has gravity in place and a large static floor sprite that it collides with to act as the ground. I've found that due to the top-forward-heavy shape of the body it does a very slow creep to the left of the screen that is almost impossible to notice as it happens but if you leave it for 5 mins and come back he's slowly crawled halfway across the screen. I originally hacked around this by just adding an invisible platform to the bottom of the body at the front in order to balance out the centre of mass, but now for other reasons that's no longer going to be possible. I took a look at the body.adjustCentreOfMass() function but it doesn't allow any parameters and the documentation is pretty vague on what it actually does, and when I call it it just causes the character to float about 10 pixels above the ground. Does anyone know of a way that you can play with the centre of mass of a sprite that has a weird-shaped body in order to stop this from happening? And has anyone had anything like this before? I had a look around but can't find anything on the topic at all.



  4. Hey all,


    Just a quick heads up to share an odd solution to a problem that had me tearing my head out for a couple of days, thought it may come in handy for anyone else in the same boat.


    While working on a game where I was using P2 physics to detect a collision event between 2 physics bodies, I found that whenever the target sprite was rotated further than a certain amount all of my collision events would silently fail. I spent AGES trying different collision methods and none of them worked, when trying to implement a hack-ish workaround that I found on the forums (can't remember where) I realised that my collisions were now working fine, even though the method I was using returned something to the effect of "this doesn't work".


    Long story short - I found that by resetting a physics body's AABB data after every change in rotation made the collision events work again:

    //attackingThing.body.onBeginContact.add(reportSomething, this);//function rotateThing() {    //    thing.rotation += 1;    // reportSomething fails unless you do this;}

    If anyone can enlighten me as to what/why/how this works, that'd be awesome.


    Phase on, dudes!



  5. Hey guys,


    Was just wondering if anyone has worked out a way to constrain multiple sprites together using the Arcade engine in a similar way to the P2 method?

    I'm mainly looking for an equivalent of the lock constraint but I guess any of them would be useful - right now i'm setting the x/y position in the update function and it's got a visible lag - any ideas?

  6. I've copied the Map Collide (mario) example as accurately as possible using tiled for level creation and i'm having real issues trying to get my hero sprite to collide with ANY of the tiles - is there some "collision" setting in Tiled I'm meant to be using?

  is my test game so far, it seems to me that either:


    • there's some "this is the collision layer" setting either in Tiled or Phaser that I'm meant to be setting
    • the game.physics.arcade.collide function is broken

    Seems to work for the demo though so not sure what's going on and because the 2.0 update is so new there's nothing on line to help me . . . 

  7. Hey all,


    Is there a way to anchor an object (Sprite, Emitter, Image, etc) to a Sprite so that they obey the commands issued to it as if they were one object?


    I know in theory there's a way to add a bunch of sprites to a group and to manipulate the order of the elements inside of it but I've already built a bunch of pretty advanced controls that rely on Sprite movement/position etc. so I'm trying to avoid having to refactor it.

    For some context, it's a hero sprite with movement & animation, and I'm trying to add a static jetpack that sits behind (z) the animation, and then an emitter that sits just under (y) the jetpack that spits out fire particles as you thrust upwards. 

    So far I've tried:

    • adding the jetpack as a child of the original sprite, but it's always in front as the hero animation is a texture (side note: tried setting the blendMode of the jetpack to show the texture through it but this doens't work either)
    • updating the jetpack & emitter's x/y values onUpdate, but this leaves a lag that makes them float around and not rigidly adhere
    • adding the hero sprite as a child of the jetpack (it allows for the jetback to appear behind the hero, but it screws up my original code as well)
    • praying to the sky gods for good fortune and wellbeing

    Any better ideas?