Jump to content

How to "pre-debug" a non-existing object?


Recommended Posts


Title could sound weird, but idk very well how to express it. I'm working on a proyect that has an inicial player just with an arcade body, and I'm trying to add invisible sprites to adjust the movements with animations cause arcade allows just one body, and those sprites will be being added and destroyed constantly, so, for now I need to debug the body of those invisible sprites while programming, but I can't do it because those ones don't exist in the game at first, I tried some if clauses on render function but couldn't get it.

create: function(){
        this.vShape = new Phaser.Signal;


update: function(){

if (this.Q.isDown) {


        } else {

            if (this.vikingo.animations.currentFrame.name == "attack_1") {

shape: function () {

        this.p = game.add.sprite(350, 89, 'attack1');
        this.p.alpha = 0.1;
        this.p.rotation = -113.6;

render: function () {


 Last I tried was creating an undefined variable this.p in create funcion and checking in render function if it was undefined do nothing else if it wasn't (once replaced with shape) execute game.debug.spriteBounds(this.p); but didin't work, it was this way:

create: function () {

render: function () {
      if(this.p != undefined)game.debug.spriteBounds(this.p);

thanks for helping

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...