XHXIAIEIN's Recent Forum Activity

  • 03: Allow move instances layer in the context menu

    It would be very convenient if we can move the instances to another layer in the Instance bar.

    04: Allow dragging instances into folders in any state

    Currently, only instances on visible, unlocked layers can be dragged into folders, which is inconvenient. I think it should have more freedom of operation.

  • 01: 'Scroll selection into view' Should be Keep Current Zoom Scale

    Currently, using'Scroll selection into view' will change the editor zoom. I think it should keep the zoom and just change the scroll position.

    02: Separately control the display and lock property of instance objects

    Currently, we can only control a layer, But it is not to target a specific instance.

    It would be more convenient if each instance could be controlled individually.

    (This is from the previous sketch)

    and add a common 'editor' property to all object types. Like the layers bar, can be hidden or locked for each object.

  • This example made by Connor Walker /gma@stickfigya

    DonkeyKongMapSystem.c3p

  • CookingMatchIngredientsJSON-2.c3p

    you are no longer using an array to store ingredient data, there is no need to sort, just compare the Loop name and the amount.

    {
    	"Recipe": {
    		"TomatoEggSoup": {
    			"Ingredients": {
    				"Egg": 2,
    				"Tomato": 2,
    				"Water": 10
    			}
    		}
    	},
    	"Play": {
    		"Ingredients": {
    			"Egg": 2
    		}
    	}
    }
    
    const dataInst = runtime.objects.JSON.getFirstInstance();
    const data = dataInst.getJsonDataCopy();
    const recipes = data.Recipe;
    const playIngredients = data.Play.Ingredients;
    
    let result = "none";
    
    for (const recipeName in recipes) {
     const recipeIngredients = recipes[recipeName].Ingredients;
     if (Object.entries(recipeIngredients).every(([ingredient, amount]) =>
     playIngredients[ingredient] === amount)) {
     result = recipeName;
     break;
     }
    }
    
    runtime.setReturnValue(result);
    
  • CookingMatchIngredientsJSON

    I changed the structure of the recipe.

    {
    	"Recipe": {
    		"TomatoEggSoup": {
    			"Ingredients": [
    				"Egg",
    				"Tomato",
    				"Water"
    			]
    		}
    	},
    	"Play": {
    		"Ingredients": []
    	}
    }
    

    I use a JavaScript to match it. If a recipe is matched, return the key name. else or returns None. This name will correspond to your animation name.

    const dataInst = runtime.objects.JSON.getFirstInstance();
    const data = dataInst.getJsonDataCopy();
    const recipes = data.Recipe;
    const playIngredients = data.Play.Ingredients.sort().join(",");
    
    let result = "none";
    
    for (const recipeName in recipes) {
     const recipeIngredients = recipes[recipeName].Ingredients.sort().join(",");
     if (playIngredients === recipeIngredients) {
     result = recipeName;
     break;
     }
    }
    
    runtime.setReturnValue(result);
    
  • Since you already have a Json content to store the recipe.

    it might be like this:

    {
     "Pancake": { "id": 1, "ingredients": ["flour", "sugar", "milk", "egg"] },
     "Butter Cookies": { "id": 2, "ingredients": ["flour", "butter", "sugar"] },
     "Muffin": { "id": 3, "ingredients": ["flour", "sugar", "milk", "butter", "egg"] },
     "Cake": { "id": 4, "ingredients": ["flour", "sugar", "milk", "butter", "baking powder"] },
     "Cream Frosting": { "id": 5, "ingredients": ["sugar", "butter", "milk"] }
    }
    

    or like this:

    [
     {"id": 1, "name": "Pancake", "ingredients": ["flour", "sugar", "milk", "egg"]},
     {"id": 2, "name": "Butter Cookies", "ingredients": ["flour", "butter", "sugar"]},
     {"id": 3, "name": "Muffin", "ingredients": ["flour", "sugar", "milk", "butter", "egg"]},
     {"id": 4, "name": "Cake", "ingredients": ["flour", "sugar", "milk", "butter", "baking powder"]},
     {"id": 5, "name": "Cream Frosting", "ingredients": ["sugar", "butter", "milk"]}
    ]
    

    Or You can also join them into strings instead of using arrays.

    "ingredients": "flour,sugar,milk,egg"
    

    Then, a core processing step is to sort the materials and the recipes, so that players can add materials in any order and then match them with the recipes.

    "ingredients": ["flour", "sugar", "milk", "egg"]
    
    // sort
    ['egg', 'flour', 'milk', 'sugar'] 
    

    Then prepare a JSON to store the materials added by the player, and finally compare whether the two contents are the same.

  • TomLaura_D I find tutorials is full of spam posts, is it possible to clean them up regularly?

    I think some kind of content review mechanism should be added to convert some posts that are not related to tutorials into unpublished posts, so as to ensure the quality of the tutorial page.

    construct.net/en/tutorials/page-2

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ChatGPT doesn't understand what C3 does and will just say things that look correct but are not the same as what they actually do.

    ArrayCard.c3p

    ---

    if you want to import some card data, you can create an Array file and then load it into the Array object through AJAX.

    Uused for reference them as the card original database.

    In the game, you can have a other Array to manage the "current card", which stores the card ID. it determines the cards that player can currently use.

    If you want to exchange, that is, replace the IDs of these cards.

  • Can you upload your files?

    Do you know what tokenat actually does?

    tokenat("apples|oranges|bananas", 0, "|")

    returns apples.

    tokenat("apples|oranges|bananas", 1, "|")

    returns oranges.

  • As the screenshot prompts, the parameters of tokenat expression are filled in in the wrong.

    The correct usage is:

    tokenat(src, index, separator)

    tokenat(cardData, 0, "|")

  • It looks like this is the effect of some of your computer accessibility software.

XHXIAIEIN's avatar

XHXIAIEIN

Member since 26 Mar, 2016

Twitter
XHXIAIEIN has 9 followers

Trophy Case

  • 8-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • x46
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x10
    Lightning Draw First person to up-vote a new Construct 3 release
  • x9
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

20/44
How to earn trophies