How do I disable "debug" objects?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi,

    I have a game with (i.e.) 1 sprite and a text object.

    Each time an new sprite object instance is created, also a text object instance is created for debugging purposes.

    I use those texts to display sprite's variable I need to check.

    If i delete the text object from the object's list all text objects references are removed from events/actions and that's ok.

    But if I later need the text object again I need to recreate it and recreate all related events.

    I'm looking for a way to disable this object when I do not need it (without deleting it).

    I can't simply disable the "create text object" even in the event sheet because those objects there are other references to those.

    I.e I have

    Select sprite where xxxxx

    Select text_object where xxxxx

    in the same event. And if the text is not created the event is not fired.

    Is there a way to disable object so all related events/actions are toggled disabled?

    Thank you!

  • Create a global variable 'debug'.

    Where your debug events are for displaying debug text, add a condition if debug=1.

    Then toggle debug to 0 or 1 before you start the game to enable/disable debug.

  • If the only effect they have is visual you can make them invisible. Either have an event that selects all and makes invisible (i.e. on tab key pressed toggle visibility) or put them all on one layer and have the whole layer invisible.

    If it isn't just visible you could have an event that destroys them all every tick. Put that in a group and can toggle the group active/deactivated

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you plinkie! Very good sooooolution!

    badmoodtaylor, your solution is also good. To switch debug of/on at runtime.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)