509Dave16's Recent Forum Activity

  • Hello to all the Constructors out there building wonderful games. I'm Dave. I am relatively new to Construct 2. I've tried Unity, GameMaker, and RPG Maker. However I came across Construct 2 through Spriter, and I've found this Game Engine to be very satisfying to use. I have a Computer Science background, so if anyone has any SDK questions feel free to post them. I've answered a few SDK related questions already(successfully I hope). It is my desire to get to know the rest of the community better, as I continue my game making journey with Construct 2 alongside the rest of you.

    Many Thanks,

    509Dave16

  • Interesting game mechanics. However, sometimes when I was holding down 'A' to prevent the Little Star from moving, I couldn't jump while moving the Big Star. In addition when near the Purple Barriers I couldn't jump when right next to them with the Big Star.

  • Looks interesting. So basically you've built an engine that emulates the same gameplay and AI mechanics as Megaman X, allowing you to build stages and what not. That's pretty cool.

  • I think the idea behind your game is cool as well as the art style. The game ran and played smoothly. Overall I felt it was very interesting though the english translation could use a little work.

  • The problem is that the Load Action for the Array Plugin doesn't load from a previous JSON file that you saved. It loads from a string as stated in the dialog for the Action unfortunately. If you want to load a JSON files contents at runtime, you'll need the AJAX Plugin. Look for this tutorial on the Scirra site for how to do this: AJAX Example with Construct 2.

  • I think I see what you are getting at. You don't want to hard code all the Event blocks for creating your different Tiled Background Object Types. That seems like a reasonable and worthwhile addition to any of the Condition or Action dialogs that require you to pick a Plugin Object Type. This would definitely be more efficient and result in a more minimized Event list. I would say that this would be a very nice dynamic feature that would be beneficial to many people.

  • My last post wasn't very helpful. However I think I found what you need. So here's some more code:

    var objectTypesArray = this.runtime.types_by_index;
    var NameTypePairs = {};
    var TypeInstNameIndexPairs = {};
    for(var araIndex in objectTypesArray)
    {
        var objTypeID = objectTypesArray[araIndex];
        var objInst = this.runtime.createInstance(objTypeID, this.layer);
        var instVarNames = objInst.instance_var_names;
        var instVars = inst.instance_vars;
        var InstNameIndexPairs = {};
        for(var instVarIndex in instVarNames)
        {
    		var name = instVarNames[instVarIndex];
    		var index = instVarIndex;
    		InstNameIndexPairs[name] = index;
        }
        var objType = objInst.type;
        this.runtime.DestroyInstance(objInst);
        var objName = objType.name;
        NameTypePairs[objName] = objType;
        TypeInstNameIndexPairs[objName] = InstNameIndexPairs;
    }
    var dialogboxType = NameTypePairs["dialogbox"];
    var dialogboxTypeInstVars = TypeInstNameIndexPairs["dialogbox"];
    var nameVarIndex = dialogboxTypeInstVars["name"];
    var dialogboxInst = dialogboxType.instances;
    
    for(var instIndex in dialogboxInst)
    {
       var inst = dialogboxInst[instIndex];
       if(inst.instance_vars[nameVarIndex] = "Joe")
       {
           var instJoe = inst;
       }
       if(inst.instance_vars[nameVarIndex] = "Jasper")
       {
           var instJasper = inst;
       }
    }
    
    instJasper.visible = false;
    instJoe.text = ".........";
    instJoe.visible = true;
    [/code:3goj65s5]
    This is assuming that the 'name' Instance Variable of the dialogbox Object Type.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As an example say we wanted to check the Text value of each Text Plugin Object Type Instance. You could use this statement to access the value:

    this.type.instances[index].text;[/code:2uk93qx3]If you look at the implementation of the Text Plugin, you'll find in the runtime.js that the Instance.onCreate has a 'text' member variable. If you wanted to look at the "Instance Variables" that you added at Edit Time you could use these statements:
    [code:2uk93qx3]
    var instIndex = 0;
    var varStr = 'text2';//made up instance variable added in the editor
    var varIndex = -1;
    var inst = this.type.instances[instIndex];
    var instVarNames = inst.instance_var_names;
    for(var instVarNameIndex in instVarNames)
    {
       if(instVarNames[instVarNameIndex] = varStr)
       {
           varIndex = instVarNameIndex;
       }
    }
    var instVarValue = inst.instance_vars[varIndex];
    [/code:2uk93qx3]
  • [/code:2wuzpy2g]I understand what you are talking about now. I've been attempting to look into how to access the Plugin Object Type Instances(basically just instances of objects). If you look at the 'Object type' and 'Instances' manual entries under the 'SDK Reference', you'll find useful information regarding the attainment of instances of an Object Type. I'm still researching on how to do this, because I've seen a few other requests like yours. Through Javascript you need to try obtaining the text contents of the Prototypes\Functions\Objects that are assigned to an Instance. Here are a few lines of code that you can put in a Plugin Action that should get you started:
     [code:2wuzpy2g]
    		var objectTypesArray = this.runtime.types_by_index;
    		var araLength = objectTypesArray.length;
    		var instValuesArray = [];
    		for (var araIndex = 0; araIndex < araLength;  araIndex++)
    		{
    				var instObj = this.runtime.createInstance(objectTypesArray[araIndex],this.layer);
    				var valueStr = "";
    				for(var item in instObj)
    				{
    					valueStr += item + " : " + instObj[item] + "\n";
    				}
    				valueStr+= "\n\n\n\n\n";
    				instValuesArray[araIndex] = valueStr;
    		}
    [/code:2wuzpy2g]
    You want to most likely set an entire String representation of the instValuesArray to a property of the Plugin you  built(or a test Plugin). Then access that property through an expression at runtime in the Event Sheet, setting an Array Plugin Instances first dimension first element to that property's string. Then use the Array's Download Action to save the Array in a file as JSON. You'll have to use a text editor and what not format the element's text in the JSON file. Basically you have to inspect this String to find out where the Names of the Object Type and the Instance Properties\Variables are in the chain. Then from there figure out how to access them so that you can set for example your SpriteFont's text. I hope this helps somehow.
  • You do not have permission to view this post

  • Hey, shukshuk! Could you by chance further clarify your question about binding a function to a Sprite Font Element? Are you wanting to update the Sprite Font element with a value returned from your getNextDialogLine(actor_a,actor_b,state) Plugin Action?

  • When I get home from work, I could send you my Skype ID and we could see if there's anything I can do to help. I haven't been using Construct 2 for very long, but I might be able to help you.

509Dave16's avatar

509Dave16

Member since 21 Feb, 2014

None one is following 509Dave16 yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies