Heroes4hire's Forum Posts

  • {"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

  • Try Construct 3

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

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

  • while

    width(local variable) <= tilemap.width+96

    width>0

    - value at (array value check local variable) =1

    arrayset value((array value check),0) to 4

    set (array value check) to (array value check)+1

    width(local variable) to width-1

    is my loop. it just freezes

    width=Tilemap.Width/96 at the start of the loop. (96 is a tile size so im getting how many tiles wide the tile map is)

    array value check, is the x coordinate in the array.

    im thinking it should, when a new tile is made; expanding the tileset(that works)

    to set the tiles in the tile map: run the while loop to check for each tile, compare what value the array holds at that position. if 1, then set the tile in the tile map. if 0. reset the tile.

    anyone see what i am doing wrong?

    i want to use an array like this, so if i add a tile to a left place, i can push all Y array values. moving the tile map. and maintaining the room layout.

    hope that explination doesnt make things worse..

  • i want each tile to be mapped from an array.

    the tile map grows when a new square is added. then i want the tiles to be drawn into the tile map from the array.

    i tried to make a function, where the tilemap width is set a local variable then i could just while loop it as long as the local variable is above 0. and -1 on each loop.

    but... construct literally came up with a box telling me "blow me" ...cant set a variable to anything but a number.

    ill get it, but everything i do makes me go back to the drawing board

    *edit* what i want, is a loop to check array for value =1. then set the corresponding tile

  • citron2010

    that used to be rojohounds job. ...7 years ago..

    absolote boss with math and anything cosign

  • glad you got ıt sorted bud

  • first, huge thanks to everyones advice! i went from no knowledge, to being able to recreate this effect.

    m00npunk, ill have a look at the extentions! it does seem reasonably straight forward (cant believe im saying that..)