dop2000's Forum Posts

  • Functions are mostly used to avoid repeating the same code in multiple events. If you are only calling that function from one event, you don't need a function. Create a sub-event and pick the instances there.

  • I know that "for each" runs with every tick, thats why I created this thread in the first place. I looked for forum entries on how to use instances with events, but I could only find examples with "for each". Is there a specific tutorial that covers instances in events that you can point me to?

    Not just "for each", but all non-triggered top-level events run on every tick. (Triggered events have a green arrow in the icon, for example "On collision")

    And in most situations you don't need to use "for each" loop, you can pick instances without it.

    Like I said, check out the official templates. This is the best way to learn Construct.

  • You don't need "For each" in this case.

    Note, that this event will run on every tick (~60 times per second). If you have lots of instances and lots of event like this, it may be bad for performance.

    C3 comes with tons of templates and tutorials, I suggest studying a few of them. This should give you an idea of how events work.

  • Picking of instances is one of the most important concepts in Construct.

    There are lots of ways you can pick one or multiple instances. Most of object events do this, for example "Sprite is visible" will pick all visible instances. There are also several System events for more advanced picking.

    It seems like in your case the best option would be creating an instance variable ID on the button object. You can set manually ID values from 1 to 4 for buttons, and then you'll be able to pick by this variable:

    Button Compare Instance variable ID=2
    

    You can also pick by UID, but this is a bad practice. It may work for a quick prototyping, but I don't recommend doing this in a real project. Or you might end up with code like this.

  • I'm trying to think of something like checking which are the grid coordinates of my current location and then use set them when I enable the tile movement but I can't find such a thing

    Yes, this may work. If you have a tilemap, you can use Tilemap.snapX(player.x) and Tilemap.snapY(player.y) expressions to place the player to the center of the current tile.

    If this doesn't work, you can try MoveTo behavior instead of TileMovement. For example:

    On Left key pressed
    Player is Not moving
    .... Player Move To (self.x+50, self.y)
    
  • Scene Graph (hierarchy) is what you are looking for.

    Create hierarchy connections between all objects in the layout editor. Select two or more objects, right-click on the parent and choose "Add selection to this instance"

    Then, when you need to spawn this composite object in runtime, create the parent object with "Create hierarchy=yes" option.

    If the object is already on the layout, you can move it anywhere and all child objects will move with it.

  • It's filling a 100x100 'grid' with tile '0' in this case.

    Yes, just filling the whole map with solid tiles. If your map is big, you can change the numbers to 10000x10000, it doesn't need to be the exact width and height.

    The next loop is looping for each tile on the obstacle tilemap. If your obstacle tilemap is 6400x3200 px, then the loop will run 100x50 times.

    It checks if each tile on the obstacle tilemap is overlapping the main tilemap. If it does, the tile on the obstacle tilemap is erased.

    My last question about it is the x on the layout drawn with the obstacle tile. Is that just for illustrative purposes?

    This is just for you to see that there is another tilemap in the layout editor.

  • It's right there in the first action on your screenshot - "offset 0,0 size 0,0"

    You need to specify the correct size and offset if you want to take a snapshot of a portion of the screen. Be aware that these values are in device pixels. You'll need to use CanvasDeviceWidth and CanvasDeviceHeight expressions of Platform Info object to convert to device pixels.

    Example:

    | Global number r‎ = 0
    + (no conditions)
    -> System: Set r to PlatformInfo.CanvasDeviceWidth÷ViewportWidth(0)
    -> System: Take snapshot of canvas (PNG, quality 75, offset 100×r, 100×r size 500×r x 300×r)
    
  • Here is a demo. It uses collision polygons in the main tilemap to automatically fill the collision map.

    dropbox.com/s/squgt33uyfuraer/AutoFill_collisionMap.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can edit collision polygons for each tile if you double-click it in the tilemap bar. However, this may not work for tiles which have walls on opposite sides, since it's not possible to have two polygons.

    I would use another (invisible) tilemap with 64x64 px tiles just for collisions. You can draw walls on it manually or fill it with an event.

    Check out this demo:

    howtoconstructdemos.com/using-an-invisible-tilemap-as-an-obstacle-map-for-pathfinding-capx

  • What you described is possible with Chadori's plugin for push notifications, part of the Construct Collection.

    constructcollection.com

  • If this doesn't help, please post a screenshot of your events, or your project file.

  • You need a server which will store the scores. It may be your own server with MySQL database, or some service like Firebase.

    Search the tutorials section, there are plenty of examples.

    construct.net/en/tutorials/search

  • Try downloading the plugin from this post:

    construct.net/en/forum/construct-3/plugin-sdk-10/erens-ported-plugins-modules-159391

    You can parse CSV files without the plugin, use tokencount() and tokenat() expressions.