oosyrag's Forum Posts

  • One of the simpler effective decollision methods I've used is the bullet behavior to push objects away from each other.

    Default speed 0, with a high negative deceleration.

    Have your object in a family to check overlap with self. If overlapping with self/family, set bullet speed to an amount you want to push away, and set angle of motion for the object and family to away from each other.

    Adjust the bullet behavior numbers until you get a satisfactory amount of decollision knockback.

    Edit: note that most games that use this type of decollision do not do it every tick. Some do it only when every x seconds or on an asynchronous thread, and some only do it only when the object is at rest. You might also want to add other conditions to prevent an object getting yeeted across the screen if there are a lot of objects to collide with.

  • Example updated, see events 12-14. I didn't add a re-enabling event, but that depends on what triggers you want to turn dragdrop back on, like on craft complete, or if the item was dropped again without overlapping the pot. It would pretty much be pick all items and enable dragdrop. Or you can filter by item.id again, like when disabling - I saved the item id to a variable, and used that to pick which items I wanted drag and drop disabled.

  • Are you using the same move to behavior on the host as the peer side? They need to match for local input prediction to work.

    Is your sync object bandwidth set to normal?

  • items.json contains the item definitions, with "id", "dispName", "animName", "aniFrame", and "desc" keys for each item. recipes.json contains recipe definitions, with ingredients (an array of item ids), and result keys for each recipe. They're different in form and function, which is why I used two files. It works the same if they're all together like they were in the original example.

    On start of layout, the two files are loaded and placed into the "items" and "recipes" paths respectively, resulting in the exact same result as when it was just one file with items and recipes together. I've included that original file into the updated example (same link), if that way is preferable.

    What do you mean only one has drag and drop enabled? If there were two of the same thing, how should which one be draggable be determined?

    There are a few ways to ensure item (or recipe rather) order doesn't matter. The first way would be to not have conflicts to begin with. So don't have an A+B, B+C, or A+C recipe if A+B+C is a recipe.

    Another way would be to use a different trigger to check recipes, like a button the user has to push (after adding items to a pot or something), so that it's not triggered immediately upon dropping. But even then order still kind of matters, you would probably just want check the bigger recipes first before the smaller ones.

    You could also explicitly define a "priority" value in the recipe json, and check the recipes in order of their priority. But this is not much different than just leaving it as is - the priority is simply the order in which they appear in the recipe list.

    One option would be to just not worry about it, and let the player figure it out. If you had A+B=C and A+B+C=D, they would have to add A+C before B or B+C before A to get D.

  • Ok so there's a few problems here, in no particular order"

    Don't use physics unless your whole project is physics based (or you really really know what you're doing).

    Your platform with the sine shaking is probably causing multiple collisions and resets. It is often

    Avoid using wait, it simply delays the actions and doesn't stop events from running in the meantime. Better to use timers and timer triggers for anything that needs to happen over time.

    Using instance variables along with the timer behavior to keep track of the state of various objects could be useful as well. I put together an example for you, hope this helps. dropbox.com/scl/fi/ngmk87fvah1ykacwttsli/fallingplatformexample.c3p

  • Set their origins so that they are all at the same coordinate and aligned. Or use the pin behavior to pin the pieces together.

  • Trigger once only works when there are other conditions with it.

  • In the event that destroys the platform, spawn a new one at it's original location.

    You can keep track of it's original position with a pair of instance variables or an invisible helper sprite.

    An alternative would be to not have the original platform fall at all, just make it invisible, turn off solid, and spawn a dummy sprite to fall instead. Then make it visible and solid again later.

  • Is your target sprite origin in the right place? Or are you targeting an image point?

    If you use move to direct and handle your own waypoints, it should be more precise, but they'll slow down and stop at each waypoint.

    Otherwise if you need precision you can try using tween instead, which will be exact.

  • dropbox.com/scl/fi/k3leq691iv54oeiq2hzz0/dictionaryjsonexample.c3p

    Yeah if you want to just display the actual key for the key code no need for a dictionary/json. But if you want to remap keys, this is when it would be useful.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, you can still save the dictionary as a JSON, edit it as text, and then load it back into a dictionary.

    You can get to the key either way, it's just easier if you use the dictionary object.

    Do you have a sample json available? I can make an example to get to the value both ways, and you can see the difference.

  • Generally speaking, you do a JSON for each, along with a system compare two values, json.currentvalue = value.

    Depends on the format of your JSON though, if you can loop through objects at a path.

    Considering you saved the json with the dictionary object though, it would make more sense to load the json back into the dictionary object, and use the dictionary.get(key) expression.

    Seems kinda silly to use the dictionary object to save as json to try to parse it as json and manually recreate the functionality of the dictionary object.

  • 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/scl/fi/cg7xje8s2lw9tq063uicx/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!