Scoremonger's Forum Posts

  • Thanks for your responses, but I don't think the current global layers do what I'm asking for, which is something I believe I saw others asking for here.

    Unless I'm mistaken, global layers aren't added to all layouts when you make them - what they do is apply the same arrangement of objects to any layer that has the name of the global layer. That's definitely handy for UI, etc., but what if I need to add new layers to dozens of layouts that don't already have them, or rename layers across many different layouts all at once? Is there a way to do this that I'm missing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • +1 here too. I would love a way to define/modify the layers of multiple layouts at once.

  • Thank you, blackhornet! That should do it.

  • Hi, I have a function that I would like to use some sensible defaults if nothing is overridden, but allow for passing in of values. So in the function I look at the values held by Function.Param(0..n) and see if they seem reasonable. If not, I use a default value, otherwise I assign the value passed in by the function to a local variable and use it.

    The problem is Function.Param() returns 0 if the script didn't pass any value, but 0 is a valid argument to pass in some cases. Is there any way to know whether the 0 returned by Function.Param() is something that was passed in or just the default 0? If the default of Function.Param() was null or NaN I could test for that and know that nothing was passed in.

    Another way to put the question is, "Is there a better way to define default Function parameters?"

    Thanks!

  • I'm now getting hit with loads of bogus tutorial emails again, so yeah you're right Cliffu, unsubscribing doesn't work. There was a third explanation apparently - the spammer was just taking a coffee break, haha... Time to add a new spam filter!

  • Either Scirra has stopped it, or I have (for myself) by going into my tutorial subscriptions and unchecking the broad categories (i.e. All English Tutorials).

    https://www.scirra.com/tutorials/subscriptions

  • Thanks jojoe, that's the nudge I needed!

    I wrote a function that takes parameters for where a given sub-tilemap is on the giant tilemap, and copies the tiles from that spot to the upper-left corner of a tilemap instance, and then resizes the tilemap instance to the size of the sub-tilemap. It functions just like I need it to.

    It's not ideal, workflow-wise - I would prefer that Construct tilemaps could share tileset textures (the way Tiled is set up.) But this seems like a good workaround.

    As for the WebGL suggestion, I could get some interesting variety out of that technique too. Thanks again for sharing your ideas!

  • Hi, I'm trying to make several tilemap layouts that could share the same tileset, but for every tilemap in the project there's also a unique texture, even if the tilemaps share the same original source image. Can someone suggest a workaround for this problem?

    My thought was to save off layouts as some XML or JSON format and load them as-needed, but I'm not sure how to do that. A workflow like this:

    Create tilemap in Construct to serve as a tileset.

    Create layouts using that tileset in Tiled editor and export as XML or JSON format that Construct can load (or TMX if that works - I don't care what format).

    At runtime, spawn tilemaps and size/populate them using the previously-exported Tiled data.

    Alternatively I wouldn't mind creating the tilemap variations in Construct's tilemap editor. These layouts aren't that complicated but there are many of them and they will need to be created dynamically, repeatedly.

    Any suggestions would be great, thanks all.

  • I'll be needing to do exactly the same thing - get all the tiles that are overlapping a sprite. There doesn't appear to be a built-in function, and I agree this seems like something that would be very useful for many, many people. I'd also like to be able to query tile size for different tilemaps at runtime, but that's another thread.

    Anyway, since we don't seem to have what you're looking for I have some suggestions you can try, with the caveat that I haven't tried them myself yet.

    You can test points along the edges of your character sprite (not just the default image point) using Tilemap.PositionToTileX() and Tilemap.PositionToTileY(). Assuming your default image point is in the center of your character sprite, this will give you the X position of the right edge of the sprite:

    Tilemap.PositionToTileX(Player.X + Player.Width/2)[/code:3nwja19w]
    
    And this will give you the Y position of the [i]bottom edge[/i] of your sprite:
    
    [code:3nwja19w]Tilemap.PositionToTileY(Player.Y + Player.Height/2)[/code:3nwja19w]
    
    Together that gets you the bottom-right corner of the sprite. Do that for all the corners and perhaps for the midpoints of all the sides and you have a pretty good idea whether your character is overlapping specific tiles.
    
    You could also manually define some image points around the edges of your sprite. I.e., add an image point the the bottom-right corner of your sprite and name it "BottomRight", then query it like this:
    
    [code:3nwja19w]Tilemap.PositionToTileX(Player.ImagePointX("BottomRight"))
    Tilemap.PositionToTileY(Player.ImagePointY("BottomRight"))[/code:3nwja19w]
    
    Not exactly perfect solutions but better than nothing; if I come across something bulletproof I'll post it. Good luck!
  • Hi,

    I would find it useful to query a tilemap at runtime and get the dimensions of a tile from that particular map (i.e. tilemap.tilewidth == 32). I don't see a way to do it offhand. Does anyone know if a tilemap's tile dimensions are exposed to the event system?

    I could add instance variables or global constants to define this or do some other workaround, but since the data about tile size already exists in the tilemap I'd like to retrieve it dynamically. I don't want to introduce an error-prone/manually-maintained method for tracking tile size if I don't have to!

    Thanks!

  • To clarify, I am not asking about a problem when running the project, I am asking about the layout editor only.

    When I'm editing a layout, it would be convenient to always be able to see the margins clearly. I was hoping I overlooked a setting that lets me change the dashed border line to a brighter color. It would be nice to have this ability, but nothing is actually "broken".

  • Hi, I was wondering: is there a way to define the color of the dashed margin in the layout editor? I'd like to make the margin line something that contrasts more strongly with my layers.

    Thanks!

  • Thanks Joannak, I had briefly checked out Spriter but I'll give it more serious investigation. It may be more flexible than I thought. $25 is definitely a bargain either way.

  • Hi,

    First thanks to the developers for making Construct 2 such a great, well-supported and well-documented product. I've used many engines over the years both professionally and as a hobbyist and Construct 2 is a joy to use! I've been blown away by all the great documentation, examples, and the active community you've built here.

    All that said, one feature that I sorely miss is the ability to create nested composite object templates at design time for later reuse. Construct's container concept scratches the surface, but I'm looking for something along the lines of Unity prefabs, where objects don't just reference each other for creation/destruction but are combined to make a new type of object entirely. I'm aware that pin behavior can be used at runtime to lock objects together, and that the container property can be used to create flat composite objects that are somewhat prefab-like, but neither quite fits the bill.

    Ideally composite objects would consist of a top-level parent object acting as a container for other objects like sprites, text, or anything else. The parent object could be accessed by scripts and would expose the child objects as properties. The child objects could be automatically pinned to the parent as well even at design time; one could drop in composite objects based on a template, move them around, rotate them, etc. without worrying about maintaining the relative positions of child objects.

    I imagine all this would be a large amount of work for you guys on the Construct 2 team (sounds like a rabbit hole to me, I admit), but I hope you'll consider it.

    Thanks!

  • Thanks for the responses! I figure the more people that request it the more likely it will be seriously considered, so I'll go ahead and put in a feature request too.