troublesum's Forum Posts

  • You can add an action to the sprite "Appearance" - Set Mirrored... but to be asking this question means you didn't do any of the tutorials Ashley provided because its was covered in the first one i think. You should give them a look... they are very useful.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • megatronx - I had this very problem as well. I tried Rexrainbow's plugin and it works well enough for creating object dynamically it was a little short of what I needed. I found a pretty simple work around though that might help. It a bit of extra code but i keep an extra event sheet that in it I create a function for each object (Sprite, Dictionary, Text, etc) with the same name and just make the return value its As.JSON element. I can them call this function where ever based on the name of the object I want and get its JSON string and load it to a temp object as needed. I also over load the function with useful commands for instance my functions that reference dictionaries all have Get, Set depending on the number of params I pass the function. This makes working with dictionairies dynamically via ajax so much easier as I feel data management is poorly lacking (currently) in C2. This is the only way I know of for now to dynamically reference objects in C2 until they are able to put it in natively.

    Example Dictionary Function Declaration:

    If the function"PlayerSettings" is called with no Parameters then it returns the JSON string of the object

    If it has 1 param then use that param as the Key and return its value

    If it has 2 param then I set the value

    Example Usage 1

    Each Setting Dictionary gets flags added to it dynamically

    Example Usage 2

    On start of layout I call the function by its string name and set the player name

    While I use more for data manage management I feel it would work for objects as well. Hope this helps

  • Ah.. there it is.. Doesn't highlight but close enough.. Thank you!

  • Hello Construct 2 community! -

    Unless I missed something (I checked the forum as best I could) there does not seem to be a "find" option available? As my event sheets get larger It becomes increasingly difficult to locate usages of global variables, functions, objects etc. As a developer I'm used to what ever IDE I'm working with to have a find function something to the effect of right click on screen, select find, type in what I'm looking for, and it will find all occurrences whether it be a variable or object or what ever and show me what line it occurs on and the file or in this case event sheet it is on. then while on that page they are highlighted so i can scroll through the document and easily see them. Not sure if this already exists and i just can't find it (no pun intended) or if it could be added?

    Thank you

  • vtrix

    You sir are my hero... Glad to see the community offering solutions as I know Ashley must be swamped with requests.

  • Sorry but no...

    You need to modify the header response server side.

    <?php

    //Allows all AJAX requests from any domain

    header('Access-Control-Allow-Origin: *');

    ?>

    CAUTION!

    If you add this it will allow all requests from any domain that this website is not hosted on. I would recommend you do more reading on this before using it. But if you don't have access to the server then its kinda moot any way.

    Curious though your sending an Ajax request to a server you don't even have access to?

  • Ashley

    I take it back... after adding more dictionaries to the Family I found that the "Create Object" method actually creates a new instance of EVERY object in the family and not just the one I had selected by UID. I cant seem to find a away around this.

    I have to always inside the function declare the object I want created removing my ability to re-use this function for other objects.

    Anyways... thanks for the help. I did learn more useful stuff but I would still like the ability to dynamically pass an object (not the instance but the object class it self) to a function and call the parameter in the Event/Action with in the function it was passed to.

    The complexity of games that can be achieved with this would be huge.... food for thought.

    Thanks again for all your hard work.

  • Ashley

    Thank you for pointing me in the right direction. I did finally solve it. Its not very attractive looking but it works. I hope someday you guy give us true dynamic object referencing but for now here is an example for anyone interested.

    <img src="http://i.imgur.com/NSEpYVR.png" border="0" />

  • Ashley

    Thank you for the prompt reply.

    This however doesn't solve my problem I don't think? If I put the dictionary in a sprite then I still have to hard code the specific sprite I want to access INSIDE the function.

    What I was hoping for was the ability that when ever I set an Event or an Action that looks for object (IE Event: "For each" or Action: "Create Object") that instead of being restricted to the list of objects in my project that I can also use a function parameter in this case i would pass the "Players" Object as a parameter to the function and be able to reference that parameter when defining an event or action inside the function.

    I could then call this function any time and pass it any Array and any Dictionary and it will take the Array and generate a dynamic number of instances of the Dictionary from it and load the corresponding values.

  • First Off... The work you've done with this is absolutely amazing... it took only 3 days of playing with this before deciding to buy a license Please don't stop the hard work.

    So on to the biggest thing that I feel would add incredible value as a seasoned developer the only thing I'm really missing is the ability to "dynamically reference an object" (not an instance but the object class its self) based on some sort of reference.

    I use functions religiously to reduce coding but any time I want create a method lets say to take an array and parse it into collection of a certain dictionary type (Create multiple instances of the same dictionary type) I have to create a function for every dictionary type and cannot create single function that passes the dictionary type I want to instantiate.

    Example:

    <img src="http://i.imgur.com/lHEVGnc.png" border="0" />

    (I'm ambitiously attempting to build a multilayer game cross device)

    Please look at the image above. I call an Ajax method to get my player list. Now I can dynamically pass any list I want to the function but I cannot dynamically specify what dictionary type to load it to. I always have to hard code it meaning I have to copy and past this function for every dictionary type I want to create. As in the example above I'm generating my "Players" instances from the list my Ajax call receives.

    I would love if I could have just one function for this process instead having to recreate the same function and hard code the dictionary type I'm loading.

    Please let me know if your working on or will at some point work on making this available. I would love this feature more than words can describe and think others would as well.

    Thank you!

  • By far the most amazing development tool I've come across... As a seasoned web developer this tools ability to cleanly integrate Ajax and web-sockets makes the prospect of making multi-player games a real possibility. You guys really out did you selves with this tool.

    Thank you