dop2000's Forum Posts

  • If there's a tilemap, you can use Tilemap.snapX(player.x) and Tilemap.snapY(player.y) expressions.

    Or use these formulas:

    x = int(player.x/16)*16+8

    y = int(player.y/16)*16+8

  • Wow, you didn't make it easy.

    and replacing the current active scroll, moving that scroll back into the inventory.

    Where exactly is this code that should move the previous scroll back into the inventory? Perhaps it should work like this:

    1. Check if there's an item in the Active Slot. If true - re-add it to the inventory, then destroy the item in the Active Spell slot.

    2. Move the clicked item to the Active Spell slot.

    .

    But to be honest, I don't like that the item is essentially removed from the inventory when it goes to the active slot. What happens if you pick up another copy of the same scroll - should it go to the active spell slot, increasing its quantity, or to the main inventory? How do you swap items in the active slot when the inventory is full?

    It will be a lot easier if the item assigned to the active slot stayed in the inventory. Just use a global variable, say ActiveSpell="invisibility". On right-click find the invisibility spell in the inventory, reduce its quantity by 1. If none left, remove invisibility spell from the inventory, reset the ActiveSpell variable to "". This is how it's done in most rpg games.

  • Could you explain how to add different items to the inventory, how to open it, steps to reproduce the issue?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No errors when using dev tools and achievements not working in Steam, can't understand why :(

    There must be some messages in the console log. Double-check that the code that activates the achievement actually runs.

  • - What to do in case of error when using F12?

    Depends on the error.

    - How to import fonts in the project?

    Right-click on Fonts folder.

  • Yeah, there's a lot of code and without the project file it will be really difficult to help.

    I noticed that you assign a tag "Active spell" to the clicked spell. But do you clear the tag from the previously equipped spell?

  • In the exported game press F12 and check error messages in browser console. Make sure Steam client is running.

    If there is a problem with Steam integration, there will be an error immediately when you start the game. If something is wrong with the achievements, you should see an error message when you try to activate them.

    And another little thing: I’ve got two special fonts in my game that I’ve downloaded and installed on my windows and linux. How to automatically install them when someone download and install my game through steam without installing these fonts separately?

    You can't install fonts on user's PC for obvious reasons. You need to import the fonts into the project and then select these fonts for all text objects.

  • Add a temporary text object and this event:

    + Keyboard: On any key pressed
    -> Text: Set text to Keyboard.LastKeyCode & " " & Keyboard.TypedKey
    

    This will tell you if the key codes are correct.

    Maybe the problem is that your script only sends "on pressed" and "on released" events, and not "key is down" (which is required for continuous movement). Again, you can use debug events to check this.

  • Didn't you ask this question a few days ago?

    Use "AreaSprite On collision with Enemy" event - it will pick all enemies inside the area. If the area needs to deal damage over time, you can do something like this:

    Every 0.5 seconds
    AreaSprite Is overlapping Enemy : Enemy subtract 10 from HP
    
  • What I want is for each Sprite 2 that's attached to then have anchors to attach to other Sprite 2s, but only when attached to Sprite 1. I'm thinking heirarchy and having children of Sprite 1 be Sprite 2 might solve the problem of in which order, but when I press Space I also want the Sprite 2s to shoot out and remake-available the anchors once present.

    Can you draw a picture, showing sprites before attaching, after attaching, after shooting-out, and different combinations of them? How long can these chains get?

    If you need to re-use the anchor points, then don't destroy them. Instead use a instance variable, for example "occupied". When attaching a new sprite, pick nearest anchor with occupied=0, change it to 1. After detaching change it back to 0.

  • Here is what happens when I add a blank tilemap, immediately resize it to 10x10 tiles, then draw some tiles on it.

    "tilemapData": {
    "width": 10,
    "height": 10,
    "max-width": 53,
    "max-height": 30,
    "data": "9x0,5,29x0,5,29x0,5,29x0,5,29x0,5,29x0,5,29x0,5,29x0,5,29x0,5,29x0,5,1310x0"}
    

    As you can see, Construct remembers the initial size and stores lots of zeros for tiles which are beyond the 10x10 area. (Here tile indices start with 1, and 0 is an empty tile. For example "29x0" means 29 empty tiles.)

    Of course, it's a negligible overhead - just a few extra bytes of data and perhaps an extra microsecond to parse them. But if you have lots of tilemaps in your game, it may be a good idea to create them with the correct size from the beginning:

    "tilemapData": {
    "width": 10, 
    "height": 10, 
    "max-width": 10, 
    "max-height": 10, 
    "data": "9x0,5,9x0,5,9x0,5,9x0,5,9x0,5,9x0,5,9x0,5,9x0,5,9x0,5,9x0,5"}
    
  • You need to pick a target instance first. When you use "find path to target" without picking, then it will always use the first instance.

    "walker var=target.tar" condition is also incorrect, it will not pick target instance.

    Try this:

    System Every 0.3 seconds
    target Compare variable tar = walker.var 
    .... walker find target to (target.x, target.y)
    

    It needs to be a single event with two conditions.

  • if the layout size is 1000x1000, does this mean that every tilemap object added contains tile data for 1000x1000, even if the object is resized to 50x50?

    I think so. When you add a new tilemap, its size is set to layout size. If you resize the tilemap, it will still remember its initial size and will store the values for those invisible tiles.

  • Or, if you are comfortable with editing project files, here is a little tool I made that converts tilemap data to a string that can be stored in Layout.json file. It also shrinks the tilemap. It can be useful if you create tilemaps in runtime and want to store them permanently in the project.

    dropbox.com/scl/fi/mda3f73tgpbmnjmv5ofde/tilemap_data_convert.c3p

  • I tested with 1000 tilemaps created on every tick and apart from a slightly higher memory usage there's no difference in performance.

    The funny thing is that you can't actually delete those invisible tiles, even if you erase them, they are still stored in timemap data. The only way to shrink the tilemap is to delete all instances of it, restart the editor, create a small blank layout (say, 300x300 px) and place the tilemap object on it.