Scoremonger's Recent Forum Activity

  • 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?

  • +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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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!

Scoremonger's avatar

Scoremonger

Early Adopter

Member since 10 Feb, 2014

Twitter
Scoremonger has 3 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

15/44
How to earn trophies