Heroes4hire's Forum Posts

  • BaconSwagg what im creating is a building system like dungeon keeper. press tile to build a room. simples.

    but. i need to know how big a room is. like in dungeon keeper. if a training room is 3x3 it has a rotating spike thing. increasing room efficiency.

    same for hatchery. 3x3, it can spawn chickens.

    same for graveyard. 3x3 has a grave that can store dead bodies in.

    library bookshelf, increasing efficiency.

    i tried deleting sprites: on created, is overlapping sprite, choose instance of sprite where sprite width< sprite width : destroy sprite... does nothing...

    the aim is just to have 1 sprite covering over all the tiles (THAT ARE CONNECTED)

    and.. somehow performs this on another tile with same y and >X... as im ending the loop it wont get there.. setting the search to start from the click i guess.

    i also ideally want to use a tilemap, not a sprite, so i can tell exactly how many tiles are in the room. but, ill work on that later. with some words of wisdom from rojohound.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok. so, i got it to check in a row. and create a sprite at the correct width.

    how do i destroy the other sprites?

    next gotta do y... but, that melts my brain

  • ive tried so many things. i just want to check a tile map for a tile. then check how many are next to it.

    spawn a sprite on the tile. and expand its width to how many are next to it.

    i get close. but then the next stage throws me off.

    i need to check Y going down.

    aim: to make a sprite that covers all tiles that are connected. updating itself as new tiles are added.

    ive had a ton of help, and really refined what it is im trying to do. but at this point. if anyone can make it work. you are a hero

    heres my current attempt. ive removed arrays making it as simple as possible

    sprite is a button that sets the room type to 4 btw

    heres the layout

  • ive got it so is makes a sprite that covers the tiles... but.. its always 1 tile behind..

    youtu.be/NBknuBtj8A0

    no matter what i do fiddeling with the numbers. but. im burn out. time for a break

  • its not in the right place, and its a sprite not a tilemap.... and it doesnt remove the existing sprite but it is working for width

  • {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"for-each-element","objectClass":"Array","parameters":{"axes":"xy"}}],"actions":[],"children":[{"eventType":"variable","name":"saved","type":"number","initialValue":"0","comment":"","isStatic":false,"isConstant":false},{"eventType":"block","conditions":[{"id":"compare-current-value","objectClass":"Array","parameters":{"comparison":0,"value":"4"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"while","objectClass":"System"},{"id":"compare-at-xy","objectClass":"Array","parameters":{"x":"Array.CurX+saved","y":"Array.CurY","comparison":0,"value":"4"}}],"actions":[{"id":"add-to-eventvar","objectClass":"System","parameters":{"variable":"saved","value":"1"}}],"children":[{"eventType":"block","conditions":[{"id":"compare-at-xy","objectClass":"Array","parameters":{"x":"Array.CurX+saved","y":"Array.CurY","comparison":1,"value":"4"}}],"actions":[{"id":"stop-loop","objectClass":"System"},{"id":"create-object","objectClass":"System","parameters":{"object-to-create":"Tilemap","layer":"0","x":"0","y":"0","create-hierarchy":false,"template-name":"\"\""}},{"id":"set-width","objectClass":"Tilemap","parameters":{"width":"saved-Array.CurX"}}]}]}]}]}]}

    oof. i hate this. but thats the code to check so far. 2 events for all that... only items are tilemap and array. if you want to see what im thinking. need to loop here

  • yes, 2 small tile maps should create a larger tilemap on top of them. ideally then destroying the smaller ones.

    then repeat when a new tilemap is created; they should merge once more.

    This should always have a big room, but can have many rooms also.

    what is the array for.. well sir, thats a very good point. mostly as i can do a search in an array easily. for eachxy element. i havent seen an obvious way to do that in the tilemap to go through each tile.

    on my newest test project. im attempting single tile build where the room (instead of checking mutiple tilemaps overlapping) will have a loop in the array to find a grouping!.

    click button to set room type. click tile to place the square. save all squares into the array.

    THEN/NOW im currently trying to get it to go through the array to the first result thats "1" (specific room) and run a loop to check the next tile. then the next tile until a tile isnt "1".

    i can make a tilemap/sprite and set its width based on this. (tilemaps idealy. as i planned to set their tiles to match the actual tiles. so A.finding the room will be exact. B. like dungeon keeper, i can have a fire around the edge using flood. i can set its colour to who owns it.)

    so, each time a room of a type is built: i will just delete all tilemap/sprites, that have this room type, and create a new one when a new tile is placed.

    does this sound..efficient/..possible? i did look up grouping within array examples, nothing stood out.

    really. i will just brute force out something that can work out room location and size.

    any help, conversation, thoughts, or obvious solutions are massively apprieciated.

    I work on c3 for 5 hours. go work. come home and keep going. so, where i am advances.

    cheers ROJO sorry its so much. exactly what i want changes. its just the overall concept i need help with lol

  • so.. really. if i just clicked on the floor, build 1 tile. then click next to it, build second tile, i could just use the array.. to .. go through all tiles. on tileroomtype=1 then check right and down. if its value is also 1, keep checking to get room width and height.

    hmm.. i tried that first. but i was trying to directly manipulate the room tilemap to accomodate new blocks. i could just erase all instances of that room type. and make a new one.

    dificulty is checking down... ill givbe it a shot

  • they wont be overlapping each other exactly ( tiles will)

    the main floor tile map will store individual tiles into an array. so. in the array it will say exactly where the rooms are... but.. to extrapolate that data...

    like dungeon keeper. a 3x3 room is more efficient than a 2x2 room. so ill need to know how big the rooms are... and merge them when enlarging them.

    just looking for an efficient way to do this.

    ive gone through many ideas. and this seems to be working the best.

    youtube.com/watch

    is where im at. im spawning in tile maps. its just an example. and i was about to do buttons for difforent rooms.

    maybe ill try using sprites. they will be invisible. its for pathfinding, pick nearest "room" where it isnt at full capacity. then pick unused tile

  • i want to check overlapping tile maps, and mix the array stored in them.

    there isnt a tilemap is overlapping event.. any ideas?

    i could just use sprites. im thinking of storing array data in a tile map.. may not use it.. but it will leave me with options if i cant save array data to a json and call it for a tilemap

  • i want to save the tilemap. and directly put its values into an array.

    can this be done with json string download?

    seems to just be saving a new copy everytime... not saving over it.

  • construct.net/en/forum/construct-3/how-do-i-8/foreach-xy-setting-value-curx-141050

    never mind, found it in a previous post. curX

  • BaconSwagg

    ok so, for each xy element. i want to set its value at x,y to a tilemap

    how do i get what x,y the check is on?

    like, it checks 1,1 and its 1. so i need to say tile map 1,1 is tile 1

  • you just saved me a day of trial and error! thaaaank you

  • 3x3 tile map. array values set: to be plus (+) (0,0=0. 1,0=1 2,0=0) (0,1=1) (1,1=1) etc

    i can loop 1 axis. just repeat 3 times. add 1 to a variable. stop when >3

    how do i loop this for a y axis also.

    im close. but, im done for the day. any advice is helpful. ty