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

Get help using Construct 2

Post » Fri Dec 05, 2014 12:15 am

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).
You do not have the required permissions to view the files attached to this post.
B
8
S
2
Posts: 23
Reputation: 621

Post » Fri Dec 05, 2014 11:23 am

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.

TILEPLACER.capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Fri Dec 05, 2014 10:37 pm

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.
B
8
S
2
Posts: 23
Reputation: 621

Post » Sat Dec 06, 2014 5:58 am

@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. :)
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu and 10 guests