How do I 2D Platformer building floor generator

Get help using Construct 2

Post » Wed Jun 29, 2016 1:43 am

I'm looking for a little guidance on how to best go about this. What I want to do is to make a building generator, that builds each floor with random decorations (based off of hotspots I designate) and all, and stacks them on top of each other to make either a sky scraper or other types of buildings.

I currently have front and back tilemaps for each building, because as you enter one, the front tiles fade away. This GIF shows an example of what I'm doing: http://giphy.com/gifs/3oEjI6PIzJYyDettRu

The best way to do this would be the use of something like "Prefabs", just make a bunch and stack them that way. C2 doesn't have anything like that though. All my tilemaps are going to be designed the same way, so they can even be interchangeable, and the windows will be in the same place:
Image

Is there a way to catalogue each setup so I can just build a bunch in a separate window and "Stack" them? Only thing I can think of is to make a ton of functions, one for each floor type and position each object and hotspot by eyeing it out.
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Wed Jun 29, 2016 4:22 am

there is a tutorial that has what you are trying. Keep in mine it isnt stacking but a random Generator for dungeon crawling but i think it can serve as an idea you can go from there.

https://www.scirra.com/tutorials/1112/p ... elike-game

https://www.scirra.com/tutorials/999/ra ... node-based

Here are two example. What i would do is create multiple tile for the generator to use and then do another generator for the inside thingy such as table n such create a flow such as a limiter for object for each such as if room one can only have three object then for each object placement randomly choose one and then lock it in place and add one. or something like that. Just an idea to start. make sure that when you are doing it document every thing in a notepad and record the result you got. This will help to save you time to see what did work and what effect you like and what effect you achieve but didnt work for you. This will stop you from doing the same shit you just did and wasted stress and time.

I havent done any thing yet but id would like to in the future. but again this is just to get you an idea and where to start.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Jun 29, 2016 10:56 am

@gearworkdragon - thanks! I'll study up and see if I can translate it to platformer/buildings. It's still not necessarily set as though It's taking pre-existing rooms I've created (like pre-fabs), which is what im ultimately going for. I'd like to have structure to my room based off of how I created them, but then just replace the tilemap to give it a different image, and keep spawn points coordinates for items/enemies.

Is there a way I can choose a specific object to spawn from a family? Like if I gave each pre-defined tilemap build a variable like "Apartment1A", and all the pieces that go with it have the matching variable. Can I then choose to spawn TileMaps with Variable = "Apartment1A"? I dont think you can spawn items from other layouts, so they would all have to be available on the layout I'm working on I think right?
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Thu Jun 30, 2016 4:47 am

you are quite right all you need is the engine to draw it once and it is stored in a memory for the sprite and yes on the layout. I would place all the object you need outside of the game and add behavior destroy if outside of layout. Thus reduce the need to create the event for getting rid of useless sprite hitting performance.

Another trick you could do is that let say that you have a spot where it could be a table or a lamp or a box. Instead of trying to get contruct two to place one of three sprite there. you could have three frame in a single sprite each frame has their origin point and collision point and animation.

Thus reduce the need to "pick n draw" to draw and use that chosen frame. and you could do something like if sprite is destroyed and is on frame 2 then do animation for destroyed sprite frame 2. or something like that.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Fri Jul 01, 2016 2:48 am

for building the rooms, I still don't have a way of doing this properly, because even if I gave each tilemap a "Name" family variable, I can't say Create Object that has name of "ApartmentA". I guess that's still where I'm stuck is trying to find a way to create specific objects in a family, because I can't choose a specific family object based off of a variable.

as for the lamp or box idea, that's how it's setup currently, each chair has a different animation depending on the style, same for couches, desks etc.
B
35
S
5
Posts: 411
Reputation: 3,406


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests