How to make(fix) a grid-based block placing mechanic?

From the Asset Store
Physics Block Puzzle game template for Construct 3
  • I've been programming a fairly extensive game lately, and am in need of a level editor. What I am having issues with is block placement, specifically, having blocks detect surrounding blocks and changing their appearing accordingly. I know there's lots of forum discussion out there for Terraria/Starbound-type block placement, but I haven't found any that match this quite close enough for me to work with. Any suggestions welcome, even a link to a forum page/tutorial I might not be aware of, I also uploaded a .capx example I made earlier tonight and it seems about as responsive as the real thing(LOL).

  • Hi.

    I have a blog post that has this mechanic although set up for arrays -

    HERE

    .

    Also this post by

    Salt

    will help you understand the concept behind bitwise numbers for tiling.

    I also made some really heavy changes to you capx to show you how it can be done in your example. Using this method though might cause problems when there are lot's of tiles on screen. Either changing to the array method or only checking tiles near to the newly added tile would help. But It'll give you a starting point.

    [attachment=0:q007viac][/attachment:q007viac]

  • Interesting solution, never thought to do it like that really. And I see what you mean about the large amount of tiles causing some sort of indexing confusion in TILEPLACER.capx with the way it's set up right now. Although, I'm not planning to have in-game manipulation of tiles(the level editor is really for me not the players lol) I was thinking you could have a save function that reads each editorTiles' animation frame number and saves that(to an array mayhap), then when loading said level, have it place basic tiles with only single animations instead of the editorTile. I'm not asking for assistance with that, just mentioning it for clarity on what my initial plan was.

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • JimmyTHicks

    Bitwise takes a while to wrap your brain around. It's a pretty neat trick though, and great if you want to build your own level editor.

    Minor

    Hey, thanks for posting that capx! I've got an old project I'd like to revive that has a level editor with bitwise tiles...I haven't looked at it in awhile, but I know my code isn't near as svelte as yours. I think I've got a good reference when I dig into it again.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)