509Dave16's Forum Posts

  • Hmm... I was probably misinterpreting the Manual's specification of 'Destroy': Remove the object from the game. I thought that meant the Instance that the Action List of the Event is running against. However, it must refer to the Instances of that Object Type in the Selected Object List. I think it would be good if the Manual was amended to have a more clear and non-ambiguous specification of the 'Destroy' Action. Thanks for your help !

  • Hey, Black2key! I have Capx that is a solution to your problem. I've tried my best to make intuitive modifications to the Event Sheet. I had to modify your Mouse Click Event Group and fully re-write the "falling" function. I put as many comments as I could in. I hope that the comments make sense, and that they will help you understand the logic of the "falling" function.

  • Problem Description

    When not using a System For Each Loop to iterate over the Instances of an Object Type, the Common Action Destroy will destroy all of the Object Type's Instances in the SOL of an Event. This is in contrast to the notion that one Instance of the Object Type should be destroyed at a time when the Action List of the Event runs against each Instance of the Object Type. Because this is not the case, Actions that perform before the Common Action Destroy in the Action List are only performed for the first Object Type Instance in the SOL before all of the Instances get destroyed.

    In contrast, if a System For Each Loop is used instead, the Common Action Destroy in the Sub-Event will only destroy the currently picked Instance of the Object Type in the loop. This allows for the Actions performed before the Common Destroy Action in the Action List to occur for every Instance of the Object Type not just the first Object Type Instance in the SOL.

    Attach a Capx

    ____ Upload a Capx to this post ____

    Description of Capx

    Should append the Text Property values of all Instances of Text Object Type to the Text Property of the one Instance of the Text2 Object Type upon

    clicking one of the two Button Object Type Instances.

    Steps to Reproduce Bug

    • 1)Click on Button with the Text : 'Save Deleted Text Doesn't Work'
    • 2)Refresh Browser
    • 3)Click on Button with the Text: 'Save Deleted Text Does Work'

    Observed Result

    Performing Step 1) only appends:

    Text 1

    Performing Step 3) after Step 2) appends:

    Text1

    Text2

    Text3

    Expected Result

    Both Step 1) or Step 3) should result in the following text appended:

    Text1

    Text2

    Text3

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 8 Pro 64-bit(6.2, Build 9200)

    Construct 2 Version ID

    Release 168(64-bit)

  • I've been looking at your .capx and thinking about what you're trying to accomplish, and I think that you need to compose a special Delete Function in the events sheet. This Delete Function would shift the elements towards the end of the array in the Y dimension when an element is deleted. So in your case the Y dimension of the 3D Array is one of those vertical columns of Cubes. And when the Cubes are deleted and there associated coordinates in the Array Plugin have the value set to 0 in the 3rd Dimension, you could have the Delete Function shift all the existing cubes that are displayed above each deleted cube shifted down by 1 in the Y dimension. I'll try to make amendments to your solution to achieve this idea, when I get the chance. But for now hopefully this idea might help you.

  • You'll need to provide the .capx that contains this issue. That would make it easier to help you. However one suggestion I would like to make is that you model your Item Combining after Wndows Explorer file selection. So you would need a Select Item Group of Events that would handle the case where you would be pressing Ctrl and Left Clicking. This could result in the Inventory that was clicked to get highlighted. Thus in the game you could repeatedly select more items, then have a Combine Items Group of Event that would trigger on a Right Click if the number of Selected Items is greater than 0. Then somehow that event group would determine what item should be created based on the Selected Items and then have the Selected Items destroyed. This is just one example. A better would be to have a Recipe that you choose to make an item from and it would automatically check to see if you have all the necessary Items and then destroy/create the appropriate Items.

  • I'm not sure if you already fixed this. However I believe I found a solution to your problem. If you look in the manual at the System Expression, there are Regular Expressions available. Regular Expressions allow you to search for matches in a string/text according to a pattern that you define such as a range from 0 to 3. In Regex, this range pattern would look like this: "[0-3]". For more information on Regular Expressions, I would advise going to the Mozilla Developers Network Javascript Guide which provided an excellent tutorial section on Regular Expression. I've attached a modified version of your .capx that will now display a message to the user when they press a button. The message will tell them if they entered a correct character or not. Hope this helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, I just need a basic Tree, Outdoor Platform, and Cloud.

  • Oh sorry you're right. There is a z-order on every layer sorry about that. I haven't been using Construct 2 for very long so I mix z-order and layers up pretty frequently. Anyways on that layer the Red Box Sprite is always drawn first then you have the a Text objects drawn over the top. However you keep having Text objects drawn on top of each other, so if one has longer text than the other then you'll see it. Like in the case of your 'paragraph 2' message it's longer so when you have the Text object that has the 'paragraph 1' text created it is drawn on top only covering a portion of the 'paragraph 2' message below it.

  • Since I don't have 500 or more Reputation points I can't PM you Sorry about that. Unless I bought Construct 2. I'd have to make like 20 more posts to reach 500 Rep.

  • Yes. Quite a few of the changes were un-necessary and very badly done. Oh I just thought of why the one problem was persisting due to repeated object creation. The first message 'paragraph 1' is being drawn on top of message 'paragraph 2! more text here!'. And that's because the Red Box Sprite is always drawn first on the bottom layer, because that's the layer you had it originally set to through that 'Every tick' Event. So the Red Box Sprite never get's drawn over the Text objects to provide a surface if you will on which to render a new Text object. But the Text Objects get drawn over each whenever they are created. So that's how you see the text of the longer message.

  • You're right I was just trying to quickly fix DialgaBrite .capx and explain it. DialgaBrite, I didn't know that you were going to have multiple paragraphs. But if that is the case then yes you don't need the 'subtract 1 from paragraph'. As to why there was a problem creating objects every time, I'm not sure. I'd have to look back at your original .capx and look again. Sorry if I caused more confusion than help.

  • Ya. You're right actually now that I think about it. I was thinking about it all wrong. Thanks for your clarifications. I'm glad it worked out in the end for you.

  • DialgaBrite, one thing to take note of is that you can re-use a Text object to display text and you don't need to keep creating the Sprite. So I removed the repeated creation of your Sprite and Text object and put the Text on Layer1 and the Sprite on Layer0. The layers were arranged in the layers tab so that the Text would be displayed on top of the Sprite. The order from bottom to top in the layers list indicates the order of rendering the Objects on each layer. In addition, since you didn't want the Sprite or Text object showing at first, I set the Initial Visibility in the Editor to Invisible for both of them. To support the triggering of making the Sprite and Text Object visible, I added a global variable that was initially set to 0 but then later set to 1 to indicate that the Sprite and Text objects were made visible. I knew that the first message was to be set first so that's where I put the Sub-Event for making the Sprite and Text objects visible. Now just like with visibility, we use that 'paragraph' instance variable on the Text object so that when it is 0 and Return is pressed we set the text to the first message and Add 1 to the 'paragraph' instance variable. 'paragraph' being 1 indicates to us that the first message has been set and that the next time Return is pressed that the text should set to the second message. So we have that additional event that is checking for when 'paragraph' is 1. Now in order to alternate we have to have the second message event subtract 1 from 'paragraph' so that we go back the initial state of waiting to set the text to the first message.

  • I'm really sorry about the last code snippet I gave you. I made some incorrect assumptions about the 'types_by_index'. It actually does contain Type objects and not Type string identifiers. So I changed the code snippet to reflect that as well as fix the one little error that you probably already found. And you can access the flag 'singleglobal'(which indicates if a Plugin is a singleton) from the plugin object like this:

    type.plugin.singleglobal[/code:1cy5vqaj]
    Also here's the revised code snippet:
    [code:1cy5vqaj]
    		 var objectTypesArray = this.runtime.types_by_index;
    		var NameTypePairs = {};
    		var TypeInstNameIndexPairs = {};
    		for(var araIndex in objectTypesArray)
    		{
    			var objType = objectTypesArray[araIndex];
    			var isSingleGlobal = objType.plugin.singleglobal;
    			var objName = objType.name;
    			if(!isSingleGlobal)
    			{
    				var objInst = this.runtime.createInstance(objType, this.layer);
    				var instVarNames = objInst.instance_var_names;
    				var instVars = objInst.instance_vars;
    				var InstNameIndexPairs = {};
    				for(var instVarIndex in instVarNames)
    				{
    				  var name = instVarNames[instVarIndex];
    				  var index = instVarIndex;
    				  InstNameIndexPairs[name] = index;
    				}
    				this.runtime.DestroyInstance(objInst);
    				TypeInstNameIndexPairs[objName] = InstNameIndexPairs;
    			}
    			NameTypePairs[objName] = objType;
    		}
    [/code:1cy5vqaj]
  • #IWFG