HappinessSam

Members
  • Content Count

    47
  • Joined

  • Last visited


Reputation Activity

  1. Like
    HappinessSam got a reaction from ivan.popelyshev in Pixi Spine runtime error   
    I'm trying to use some spine animations in a large Pixi application at work. It's mostly working but I'm getting intermittent runtime errors coming from the Spine objects.
    This error is:Uncaught TypeError: Cannot read property 'transform' of null
        at Spine.e.updateTransform (pixi.min.js:formatted:4401)
        at Spine.autoUpdateTransform (Spine.ts:479)
        at e.updateTransform (pixi.min.js:formatted:4405)
        at e.updateTransform (pixi.min.js:formatted:4405)
        at GameScene.e.updateTransform (pixi.min.js:formatted:4405)
        at e.render (pixi.min.js:formatted:8605)
        at Function.ScenesManager.loop (ScenesManager.ts:273)
        at t.emit (pixi.min.js:formatted:13126)
        at t.update (pixi.min.js:formatted:13068)
        at _tick (pixi.min.js:formatted:12988)
    The error is coming from PIXI.Container, line 323 because this.parent is null. This is a bit bonkers because this is only being called because the spine object is in the children list of the scene being rendered.
    this.transform.updateTransform(this.parent.transform); I dug in a tried to isolate the problem and found that somewhere in the Spine update function the parent was being set to null. In Chrome debugger I put in some conditional breakpoints for
    dt>0 && this.parent==null and found that the culprit was line 184
    this.state.apply(this.skeleton); Before this line the breakpoint doesn't trigger, after it it does, with this.parent being null.
    I had a read through AnimationState.apply and I can't for the life of me see anything that would be setting the Spine parent state. So my question is can anybody else see anything in there that might be creating this effect?
    I should say that the application does a bunch of complicated pooling of symbols, so the Spine object might be getting removed and sent back to the pool then re-added frequently. But my understanding was that since JS is mostly single threaded if this.parent exists on line183 but not 185 something between there must be setting it to null.
    I'm not extending or doing anything else to the Spine object. Unfortunately I can't give out any coded to show the context. I'd be really grateful if anybody has any suggestions or input.
  2. Like
    HappinessSam got a reaction from ivan.popelyshev in Pixi Spine runtime error   
    This has worked fine and touch wood is working perfectly now.
    I was also getting an occasional flickering issue which has cleared up after setting the spine's autoupdate to false and updating manually - maybe this apporach would fix https://github.com/pixijs/pixi.js/issues/4117 too.
  3. Like
    HappinessSam got a reaction from ivan.popelyshev in Pixi Spine runtime error   
    Thanks! That's great info. I think I will look into manually call update, as that looks safer.
  4. Like
    HappinessSam reacted to ivan.popelyshev in Pixi Spine runtime error   
    Heh, nice one. We have to add guart in auroUpdateTransform - if object was removed after update(0) , dont do updateTransform. Better if you created an issue in pixi-spine repo for that, but here is fine too.
    https://github.com/pixijs/pixi-spine/blob/master/src/Spine.ts#L469
    PIXI.spine.prototype.autoUpdateTransform = function() {... if (!this.parent) return; ... } However there will be side effects - neighbour updateTransform() wouldnt be called because that all exists in a loop inside updateTransform of parent. 
    Better solution is to switch all autoUpdates (Spine.globalAutoUpdate=false or autoUpdate of every instance), and manually call update() from your game loop. autoUpdateTransform is a great hack, it exists because pixi doesnt have animation loop.
  5. Thanks
    HappinessSam got a reaction from wipster in Make rectangle/polygon or any graphics object clickable?   
    To make a Phaser.Graphics clickable, set inputEnabled to true then ass a listener + context to it's events.onInputUp handler. If you want the cursor hand set it's input.useHandCursor to true. There is no hitArea as far as I know, it just uses the dimensions of the image. That post may have been thinking about the body hit area that is used for physics - this you can change.
    So something like this should create a red square which is clickable and show the hand when you roll over it. (not actually tested in a game but I think it should work)
    var graphics = game.add.graphics(0, 0); graphics.beginFill(0xFF0000); graphics.drawRect(0, 0, 100, 100); graphics.inputEnabled = true; graphics.input.useHandCursor = true; graphics.events.onInputUp.add(onClick, this); function onClick(target, pointer){ console.log("hooray"); }  
  6. Like
    HappinessSam got a reaction from Nrjwolf in Viking: Way to Valhalla   
    Really nice game and I'm impressed that you managed to make it in 1.5 months. All my 5s are yours.
    I agree that the tutorial is a bit rough around the edges but it's simple enough to work it out that I think you can get away with it.
  7. Like
    HappinessSam got a reaction from thefailtheory in Dungeon Slog - roguelite action rpg   
    I've just release my new game one the play store!

    The game is Dungeon Slog. It's an action/arcade rpg with roguelike elements. In it you need to fight your way through a randomly generated dungeon of monsters, levelling up, buying items and choosing which member of your party is best suited to the current challenge.
    It was programmed in vanilla javascript using Phaser as the game engine. I used l10n for the localisation (even though I have yet to actually localise it into another language) and Apache Cordova to package it as an app.
    I used the Oryx tileset with additional icons bought from Gamedev market. The music is by Eric Taylors, sound effects by Kenney
    Feedback, questions, bugs or suggestions more than welcome.
    Gameplay trailer:
    Screenshots:


  8. Like
    HappinessSam got a reaction from spinnerbox in Make rectangle/polygon or any graphics object clickable?   
    To make a Phaser.Graphics clickable, set inputEnabled to true then ass a listener + context to it's events.onInputUp handler. If you want the cursor hand set it's input.useHandCursor to true. There is no hitArea as far as I know, it just uses the dimensions of the image. That post may have been thinking about the body hit area that is used for physics - this you can change.
    So something like this should create a red square which is clickable and show the hand when you roll over it. (not actually tested in a game but I think it should work)
    var graphics = game.add.graphics(0, 0); graphics.beginFill(0xFF0000); graphics.drawRect(0, 0, 100, 100); graphics.inputEnabled = true; graphics.input.useHandCursor = true; graphics.events.onInputUp.add(onClick, this); function onClick(target, pointer){ console.log("hooray"); }