oosyrag's Recent Forum Activity

  • For an infinite world, it is often preferred to move everything else around the player, instead of the player object itself.

    The player stays in the middle of the layout (which would be maybe 2-3 times the size of the viewport). The layout can contain what is active in your world (known as a reality bubble in some games). Things outside the layout can be destroyed and recreated when approached by generating it again from the seed.

    If the world is modifiable by the player, you would additionally need to keep track of the difference between default state and current state of objects, such as if a tree got chopped down.

  • Try this -

    The example has also been updated again (I hope!)

    Here I'm setting the item ID directly after creating the object (based on the number of entries in ".items" in the json file). Then, I loop through each ".items" in JSON to see which one matches the ID of the object I just created. If it matches, then set it to the animation to the ".animName" that is located in the same JSON entry that matches the ID.

    One alternate way you can work with JSON is that if the order of your objects in JSON is fixed, such that the index of the array matches the id of the object (Item ID 2 is at array index 2 of the ".items" array), you can look it up directly with a absolute path instead of a relative path. The path would be "items.2.animName". It's a string, so you can stick an expression in there with &.

    Item: Set animation to JSON.Get("items."&Item.ID&".animName") (play from beginning)
    

    If I were to do it this way in this case I would get rid of the "ID" key in the json completely, the index/position of the object becomes it's ID.

    Edit: I think a lot of your roadblocks are coming from the JSON object. It's a little less user friendly to work with than an array or dictionary. One of the biggest advantages of JSON it is that it can make it easy for end users mod your game if you keep data in an easily readable JSON file (or collaborators who are not familiar with construct/code in an open source project, for example). If you're the only one who is going to be working with it, it might make more sense to just use an array or dictionary directly. On the other hand, this kind of crafting system project is an excellent application of JSON, and a good way to learn how to use it.

  • I imagine drag drop for controller would just be enabling 8 direction on the object you are over while button is down. 8 direction for the cursor as well.

  • How are you spawning items randomly? When you spawn the item, you can look up what it is supposed to be from the json (or a dictionary or array list). Alternatively, you can just set the ID randomly first, then set the animation based on it's id instead (looking it up in the json again).

  • Here's a visualization of what happens during an array pushing, see if it helps. When you push, you only push on the x axis, the other axis gets filled by whatever you pushed.

    docs.google.com/spreadsheets/d/1muTLyfKFaxD5WykJ2YoKYfg_lRQeuuABC5HwNi2t670/edit

    NaN means "Not a Number", which is what you get when you try to combine a string (animation name) with a number (ID), and try to put it into a number variable.

    I'm not sure about what's wrong with setting your items from the array, but maybe try again when your array is how you want it.

  • For situations like this, I like to use an invisible helper sprite, a "spawner" that stays in the original position and keeps track of values like timing and position.

    The objects created from the spawner can have an instance variable "origin" or "source" that I like to set with the UID of the spawner on created, so that each instance knows where it was created from, and I can use that to pick the correct spawner when the object gets destroyed. This helps in situations where you might have to work with multiple spawner objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can disable the drag drop behavior with actions when you no longer want it to be able to be dragged and dropped.

  • Use the timer behavior for the intervals. You can use global variables or an array to keep track of wave properties.

  • What exactly are your restrictions?

    What didn't work well with drag and drop?

  • dropbox.com/s/j2oyalr4sc6b5ny/dragdropcraftingexample.c3p

    Sorry! Didn't realize I had two copies in my dropbox. Try this one.

  • Use the timer behavior. You can use multiple timers with tags.

    For the quick hit, on key pressed set a timer "attack" for 0.1s, and another timer "charge" for 1s.

    On key released, stop the charge timer.

    On timer "attack" trigger, check to see if timer "charge" is running. If it isn't, then attack.

    On timer "charge" triggered, then you can immediately unleash the charged attack, or set a variable "charged" to true. On key released, if "charged" is true, then do charged attack.

    Note that games like Zelda classically do the normal attack first no matter if you hold the button down or not, that would make it simpler. Then you simply check if the key is still down up on the animation finished to start the charge timer.

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