oosyrag's Recent Forum Activity

  • I made an attempt to refactor and simplify the example, as well as allowing it to be more flexible in terms of number of ingredients, and ended up redoing it in a way that made more sense to me. Maybe this might be of use to you.

    dropbox.com/s/r0tnsmpimtrr7ik/dragdropcraftingexample.c3p

    Instead of using global variables, there is now a second array to keep track of matching ingredients, which allows for recipes of any size. This array is also used to delete the used ingredients by UID, so the instance variable that kept track of "used" is no longer necessary either.

    The overlap array now keeps track of both the item id and the UID of every overlapping item, so that each individual instance is kept track of.

    The JSON format for the recipes changed a little to make it more flexible as well. The ingredients list is now stored in an array inside an "ingredients" object, which can include as many ingredients as you want, without having to define id1, id2, ect.

    So it looks like this now.

    "recipes": [
    	{	
    		"ingredients": [0,1,2],
    		"result": 3
    	}
    ]
    

    Edit: Updated the example so it shows how to load json from multiple files, since I would personally keep them separate in an "items.json" file and a "recipes.json" file.

    Note that recipe matches are currently prioritized by first valid match. If I were to improve on it I would probably design the crafting system so that the order of the recipes in recipes.json doesn't matter. Basically account for conflicts to prevent situations where there may be two valid recipes ahead of time (such as defining what happens if you have a and c overlapping already, and drop a b onto it when you can have the recipes a+b=c, and a+b+c=d).

  • Rather than layouts, you probably want to hide and unhide layers for the local peer.

    Layouts will break object syncing - that is the host will attempt to sync objects regardless of the layout state of the peer I believe.

    It is possible, but you'll probably end up with a custom syncing system in the end.

    Alternatively, you can move the viewport of the local peer to an area not relevant to the main multiplayer game. This might work with layouts as well.

  • I thought the instance being dragged (item) wouldn't get set to used without the additional action, as opposed to the overlapping instances (items). But if it works without it that's fine too!

  • Afaik yes. Room connections should be completely independent from layouts.

    But object syncing becomes more complicated by a significant degree when trying to use layouts in a multiplayer project.

  • editor.construct.net

    The built in high score example

  • What are you using to identify/authenticate users in the first place?

  • It works, just your orange has an ID set to "3" in the layout editor. If you follow the JSON, it should be "1", and the yellow one should be "2" (the yellow one is 1 right now).

    In event 6, the array size should be set to (0,1,1) so that it resets, or empties the array. Then the new values get pushed in. If it is (2,1,1) the way you have now, the first two entries will be 0 and then you'll add entries after that (basically you'll always have a red thing mixed into your stack).

    Right now only two of the items out of the three used instances get destroyed, because only two instances get set as "Used" in event 16 and 17. To fix this is a bit trickier. You'll want to set the "Used" instance variable in the family "Items" instead of the sprite object "Item".

    First delete the "Used" instance variable from "Item". Then add a new "Used" instance variable in the "Items" family, set to boolean. You can delete events 16 and 17 completely. In event 7, add the actions for "Items: Set Used to True" and "Item: Set Used to True", you'll need both. Then in event 8, after the function is called, set Items and Item Used to False. Finally in event 18 (formerly event 20, if you didn't delete 16 and 17 yet), add the compare boolean condition "Item is Used".

  • The listroom expressions are used in an "On room list" trigger event.

    To get this event to trigger, you'll need to use the "Request room list" action.

    The index will specify which room's information you want from that list, as the list can contain multiple rooms.

    To get the index number of your current room, you're going to loop through the list until you find the index of the room that matches "CurrentRoom". It will look something like:

    On room list
    Repeat Multiplayer.ListRoomCount times
    Compare two values "Multiplayer.ListRoomName(loopindex)" = "Multiplayer.CurrentRoom"
    
    Set text to "Multiplayer.ListRoomMaxPeerCount(loopindex)"
    Stop loop
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use scale inner, and design your game so that nothing important gets cut off with a narrow aspect ratio

    Or use scale outer, and design your game so that your backgrounds and layouts allow for a wider viewing area.

    Scale outer is generally more common. You can use a custom background/texture which would show up instead of black bars, if you absolutely need to have a fixed aspect ratio for your game.

    construct.net/en/tutorials/supporting-multiple-screen-17

  • Did you have an idea of how you wanted the interface to be or how you would want the process to look? If you could describe what you want I wouldn't mind trying to put together a system for you, I haven't done a crafting system myself yet.

  • Did you have a version with the third item set up? It sounds like it should work. I could take a look and check what you did if you don't mind uploading that version.

    The tricky part might be in event 7. Add a for each (family) items, to add all 3 (or more) items to the colliding items list.

    However (IMO), drag and drop isn't the greatest system for 3+ item combinations. With drag and drop, mechanically a user is interacting with 2 things, the dragged item and the target.

    I think crafting slots would be more suitable if you want bigger combinations, or click /select to add to a list, then combine/cancel. It gets more complicated when having more than 2 items.

    Edit: An alternative option is to have a the third item combine with the result of the first two, which could keep things much simpler, but may or may not work depending on your design goals.

  • Is your timer hidden by anything? Also make sure the correct event sheet is linked to the correct layout.

    Otherwise, there isn't enough information to help without seeing what you did.

oosyrag's avatar

oosyrag

Member since 20 Feb, 2013

Twitter
oosyrag has 38 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • 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
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

21/44
How to earn trophies