dop2000's Forum Posts

  • with everything formerly worked on there, how would I now implement the new into the old?

    It's your game and only you can answer this question. I mentioned before that your system of attaching sprites with dx/dy instance variables and a dictionary was overly complex and error-prone. I understand you based it on R0J0hound's advice - he's a brilliant programmer, but he works in Construct 2, where hierarchies don't exist. In Construct 3, the hierarchy feature would be a much simpler and more efficient solution for your task. That said, you don't necessarily have to switch to it.

  • You can add a 1-2px offset with bbcode. But it's possible that some texts will become clipped on the right.

    Another option is to convert this font to spritefont and use spritefonts everywhere.

  • I strongly suggest starting using JSON instead of arrays. It will take a little time to learn, but will save you a lot of time and headache down the road!

    Consider this JSON, which stores all weapons in the game and their stats:

    {
     "IronSword": {
     "Type": "Melee",
     "Rarity": "Common",
     "Damage": 25,
     "Attack Speed": 1.2,
     "Crit Chance": "5%",
     "Range": 1.5,
     "Durability": 100,
     "Special Effect": "None"
     },
     "SteelAxe": {
     "Type": "Melee",
     "Rarity": "Uncommon",
     "Damage": 40,
     "Attack Speed": 0.9,
     "Crit Chance": "3%",
     "Range": 1.3,
     "Durability": 120,
     "Special Effect": "Cleave"
     },
     "HunterBow": {
     "Type": "Ranged",
     "Rarity": "Common",
     "Damage": 18,
     "Attack Speed": 1.5,
     "Crit Chance": "10%",
     "Range": 8.0,
     "Durability": 80,
     "Special Effect": "Quick Draw"
     },
     "Longbow": {
     "Type": "Ranged",
     "Rarity": "Rare",
     "Damage": 35,
     "Attack Speed": 1.1,
     "Crit Chance": "15%",
     "Range": 10.0,
     "Durability": 70,
     "Special Effect": "Armor Pierce"
     }
    }
    

    You can access any stat directly with a single expression, for example: WeaponJSON.Get("Longbow.Damage"). It's a lot easier than dealing with arrays!

    .

    Besides, JSON is flexible - you can create records and structures that are simply not possible with arrays:

    .

    And here is a more advanced trick - I often store the data as an array in a table format, which makes it easy to view and modify in the editor. But at runtime, I convert it to JSON. I've been using this method for the past few years with great success.

  • That's only a small part of the code. Did you implement all other steps? It feels like you don't fully understand the idea.

    Here is a demo - click any molek sprite to destroy it and break apart the remaining chain.

    dropbox.com/scl/fi/11l3w99yrnteao5t1atqn/MolekDemo.c3p

  • You don't have to use the family in all code. Think of it as an alias. It's useful when you need to pick two instances of the same object in one event - one by object's real name and another by its alias (family name).

    Otherwise you can use Molek or MolekFamily, it doesn't matter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe two sprites on a layer that only become visible where they overlap?

    Yes, put both sprites - the one you want to reveal and the mask - on a separate layer, enable own textures and set a blend mode on the mask. See the Blend Modes example in the editor, it demonstrates all modes.

  • Strange thing number 2 is that even the example from Construct editor.construct.net is not working. It can unlock levels, but the clear button does not work until the project is reopened. I even tried to force restart the layout by pressing the button after clearing, but nothing changed.

    The layout is restarted already, but the array is not cleared. Simply add this action to the last event:

    -> System: Set gameFirstExec to True

    This will force reading the array from LocalStorage, and because the key is removed from LocalStorage, the array will be filled with default values.

  • That's not a script, that's Construct code in pseudocode. You can re-create it with events on the event sheet.

    You will need to use a family to allow picking two instances of molek independently in the same event, and then to check if they overlap each other.

    This event won't work because the same instance of molek can't be attached and not attached at the same time:

    Molek is attached
    Molek is NOT attached
    Molek overlapping Molek

    That's why we use families:

    Molek is attached
    MolekFamily is NOT attached
    Molek overlapping MolekFamily
    
  • even though the type is strictly set to "number"

    Textbox always stores text, no matter what type you set.

    To convert to numbers use int(Textbox.text) or float(Textbox.text)

  • What do you mean? Where what would go?

  • We do this in Moonstone Island.

    Our world is made up of individual islands (tilemaps) arranged on a 10x10 grid, so the JSON looks like this:

    {"island1_1":{objects}, "island1_2":{objects}, "island1_3":{objects}, ...}

    Based on the character's location in the world, we create the corresponding tilemap or multiple tilemaps and all their objects.

    1. Look at a small zone around the player (about 1000px in each direction). If an island in that zone doesn't exist yet, it gets created together with its objects.

    2. Check for islands that are far away from the player (more than 2400px). Those distant islands, and all objects on them, get destroyed.

    This way, only a few islands (usually 1-2) are loaded at any given time, depending on where the player is.

  • Feels like your array is storing string values instead of numbers. Or perhaps the size is wrong.

    Can you add an action "Array -> Download" and post the result, for both affected arrays?

  • On PC you are downloading the data in Base64 format, which is basically text.

    On Android you are sharing a binary file - i.e. not text. You need to convert the data to Base64 before sharing.

    You can try this:

    -> BinaryData: Set buffer to UTF-8 text Self.GetBase64
    -> Share: Add file Levelname&".txt" type "text/plain" from BinaryData
    
  • Here is an example of knight movement:

    dropbox.com/scl/fi/if73d7fsl1hfrxrkirp1m/Chess_example_knight.c3p

    You can create similar patterns for the other pieces. For pieces like rooks and bishops, you'll also need to use LOS to check for obstacles in their path.

    That should cover the basic movement rules, but you'll still need to handle the rest of the mechanics: capturing, castling, check and checkmate detection etc.

    And if you plan to add AI, the difficulty goes up dramatically. I don't think that's realistically achievable with pure events in C3.

  • My Dropbox keeps saying "can't load this file type" what do i do?

    Click "Download" button.