Editing instance variables at runtime

0 favourites
  • 8 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi,

    I'm looking for a way to check and edit my instances properties at runtime with navigator tools (google inspector for exemple) or something else.

    For exemple, i have a spaceship in my game, and it has many properties. Some are object properties (x, y, ... related to sprite type object) some are behavior properties (velocityX... related to the physic behavior), and some are custom properties (life... custom variables i made).

    I want to know if there is a way to see those values, and edit them in runtime (if possible), while i'm playing, in order to tweak efficiently my game (no more play/quit/tweak/play... needed).

    I'm sorry if the answer has already be given, but I can't find it.

    Of course i can do my own "debug edit mode" with textfields and stuff, but i'm looking for an "automated" method, using a navigator tool/custom tool.

    Thanks !

    Romain

  • hmm if you wanna see the properties you can put text object with evnt : everytick -> set text and put the thing you want.

    if you want edit maybe you can use textbox i never tried it but the event will be like this :

    everytick : global variable = the text on textbox

    and put everything on a global variable for example for X position put a global variable called : "player_X"

    and so on for everything...

    try it and tell us if didn't work ^^

  • Thanks zsangerous, this could do the trick indeed.

    But I was looking for a more "automated" solution, which doesn't need textbox creation or stuff like that. When I see tools like Google Inspector, or Firebug, i think it may be possible (but i don't know how, and maybe it's a wrong idea).

    Of course, if there's no such solutions, I will try the "custom debug mode" with textboxes, and global variables, or create and share a plugin for this :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not really sure I understand what you're looking to do. How do you want to edit the variables, can you explain in detail? I haven't seen Google Inspector or Firebug.

  • Ok i'm gonna try to explain this more precisely :

    what I would like is to access to all my game/instance variables and properties, during the runtime, while i'm in the navigator.

    I'd like to access values, read it and rewrite it if possible.

    I was talking about Google Inspector as an exemple, because it's already a good tool to check some data about your game :

    For exemple, if you try to use google inspector in your game (right click > "inspect" under chrome) you can see a Console, then you can check ressources/SourceCode/Network access...

    All these data can be usefull (for exemple you can check the 'Local Storage' in the "Ressource" tab, and see all the key your game have stored, then modify the value if you want to), but I can't find the instance properties on it.

    I was wondering if this tool (or a similar tool maybe someone have dicovered) was able to show also the game/instance properties (x,y, velocity...).

    The purpose would be to gain a lot of time during the tweaking process :)

    Of course, maybe I'm overestimating the tool power, in this case, i'll try a more specific approach (textboxes...).

  • i don't think these stuffs work on html5 :P i really don't know these stuffs hehe ^^ try my idea as you have no limit for events ^^

  • I think it's totally in the realm of possibilities, but it would require a plugin.

  • A full blown debugger is something that has been on our todo list for a while, but it is very complicated. So it's not in our immediate plans. Chrome's debugger is very good, but our engine is so complicated it's generally not practical to use it for Construct 2 games. You can find things if you know where to look, but it can take a long time to find them because they're all buried deep in different data structures and in different places. I'm afraid the only way to go for now is roll-your-own. We're aware this is not ideal so hopefully it will be improved in future.

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