ScrotieFlapWack's Forum Posts

  • OMG!

    Thank you so much Magistross.

    That's it!

    I now have a simple system of tiles being generated on the right off screen and when they reach the left off screen they are destroyed. What a relief. I've been working all week to get this result, I can't thank you enough!

    Now I can progress and figure out how to change each tiles animation on this sprite object, depending on its neighboring tile. Like a procedural system. First though I will set the maximum height my floor tiles can be.

    Thank you so much Magistross, thank you!

  • I have been messing around with my idea of using a sprite object and storing each tile in its own animation state within that sprite object. This works great for storing each tile in one object. I can now set the X position of the sprite object in my layout to -1 every tick to get that scrolling effect.

    I've even made a global variable which I then use some simple math on to generate tiles on right side off my layout off screen so I get endless tiles scrolling across the screen.

    My problem now is that the tiles that are going off on the left of the screen I need to destroy, because I am using one sprite object for my tiles whenever I destroy those tiles with a condition that compares two values e.g Tiles.X < LayoutWidth("TilesLayer") -1, all of my tiles then get destroyed because each generated tile is an instance of the sprite object.

    Is there another method to destroy an instance without affecting all instances?

    If this isn't possible I may need to start looking into other ways to achieve this. It's frustrating that something like this is taking me so long considering that this program is so easy to use

  • After doing some thinking I realized that I could be using a sprite rather than a tilemap and still keep the performance relatively well.

    I've used one sprite object and I have imported each of my tiles in as animation frames. This way I can now manage each frame of the animation as it's own tile (similar to a tilemap) and still have the ability to set it's X position to every frame of the game to give a scrolling effect.

    This should make the generation of tiles a lot easier as well because now I can use my animation frames to figure out what tile can go next to another without the use of an array.

    Hopefully it is possible to do instances of sprites at different animation frames so my method can work this way rather than having a sprite object for each tile (which isn't what I want).

    I will continue to work on this and if this method works I will post a video and possibly write some information on the process, maybe I can make a sample .CAPX file and share that to the community as a thank you for everyone's help

  • Great examples guys. Thank you so much!

    I am still going through the material you guys have posted, so far it isn't exactly what I am looking for although I have still learnt some good techniques!

    My issue is that I am using a tilemap and need to make the tiles scroll. There is no condition or option for a condition or action that will allow me to scroll tiles that are within a tilemap (set the tiles positions).

    I can set the maps position and do simple math such as, every tick move the tilemaps position -1. This gives a scrolling effect but it moves the tilemap and not the individual tiles. So if I wanted to generate more tiles on the right of the screen I can't because the tilemaps position is constantly -1 on the X axis every tick.

    All I need is to make my tiles scroll across the screen, I can't seem to do this with a tilemap so I am trying to figure out ways I can use the tilemap to store my tiles (kind of like an array) to spawn and move the tiles X positions every frame to give a scrolling effect.

    I was thinking of saving my tilemap as a .JSON file and then loading that .JSON file into an array and then looping through the array to place down my tiles in my layout and have those scrolling but then I don't think that would work. I need something where I can set its X position every frame -1 to give a simple scrolling effect, I could do this with sprites and import every tile in my tile set as a sprite and store that in an array but this is for a mobile game and I need to be careful with performance (I have a lot of tiles and that's not including my character or prop sprites).

    I'm not looking for a level builder just an idea on the logic of how to make tiles in a tilemap scroll, by either setting their X position every frame or some other method somebody else knows about.

    Thank you though for your replies I really appreciate the material you have sent over, some very interesting techniques

  • Still no answer on this?

    I've been trying to do this for 3 days now and cannot figure it out. I don't think it is possible to move tiles in a tilemap. I may have to look in to other ways to achieve this.

    I guess I could bring in my tiles as separate sprites and store those sprites in an array.

    Any help at all on this would really be appreciated, I'm surprised I've not yet got an answer on this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would like a basic run down or opinion on what the best way would be to incrementally move tiles in a tile map.

    In short, I am creating an endless runner and want to have the tiles in my tilemap scrolling to the left of the screen and anything that goes off the left of the screen gets destroyed.

    In a separate event sheet I am creating and setting a tilemap object in my main layout (I am also creating a character but that isn't important right now). I want the individual tiles to scroll to the left of the screen and all tiles that go off the left of the screen get destroyed. I want to be able to generate these tiles and get them scrolling to give the illusion of an endless level, there will be variations in height for the platforms but that I will deal with later haha.

    I have been trying for a 2 days messing with some logic. I came across this tutorial https://www.youtube.com/watch?v=I05TDijQx-Q which does seem to help a little until he starts moving the platforms, then I can't seem to translate what he is doing in Fusion 2.5 to Construct 2.

    I have learnt about expressions now and I am getting fairly comfortable in Construct 2.

    I have made a global variable which the guy in the video also does and he performs some math on that variable which basically creates the platforms. I have jumped ahead making this variable because I can't make my tiles scroll using the same method he does in the video because he is using objects and not a tilemap. I can make the tilemap itself scroll but then that isn't what I want to do as the tiles that get created won't be seen due to the tilemap scrolling off the screen.

    The reason I want to use a tilemap is because I have heard they work great in regards to performance and there is variations in the floor such as gaps and height which have specific tiles associated to that. Once I figure out how to get the tiles to scroll and not the tilemap itself, then I can start adding in rules to adjust the height and gaps of my tiles and choose the appropriate tiles that make sense (if that makes any sense lol)

    It seems very easy when I write down my thoughts of this process on paper but then using the conditions Construct 2 has to offer I feel a little lost on how to make the process work.

    The final result I want is to have an almost procedural generator which will generate my tiles as they scroll off screen and have variations in the tile gaps for obstacles such as spike pits or holes to fall down. In my mind I am thinking that I can make the tiles off screen on the right and have them scroll on screen, then get destroyed off screen on the left and this is a constant generation with all the variations I mentioned above working with rules to place the tiles in positions that make sense.

    Any help is appreciated

    Feel free to add me on Steam or Skype if you want to talk if you have the time. I would greatly appreciate it, I am still learning and although this may seem a simple task, it feels incredibly difficult for me to work out.

  • Hi Guys,

    I am looking for a little bit of help in regards to coding the logic of some level elements.

    I have started to bring in some elements to my game to test some idea's and I am struggling on how to code them and give them functionality.

    I have a saw in my game which is an obstacle the player must dodge and not get hit by. The saw is something I want to move up, down, left and right. I have seen some tutorials which use sprites as boundaries in order to keep the AI in specific area's. I have a simple set up at the moment here is a screenshot.

    The saw for this section of my game I want to move up and down, but I have other sections where I want the saw to move horizontally as well. I did get the saw moving horizontally through a simple event which basically stated

    if the saw is > 0, set y position, 415.

    This got my saw in the correct position and with the platformer behavior I simulated left and right movement through a global variable called 'Patrol' (0 was left and 1 was right). I don't know if this is the best way but it did work as I wanted in regards to the movement of the saw my only problem was I was unable to get the saw moving vertically when I wanted. I was thinking of using separate event sheets but then I thought that just complicated things and wouldn't really be the best solution to how I want to use the saw throughout my game.

    I guess what I am asking here is, would it be possible to have an object move on its own in multiple directions? I am struggling to work out the logic and what behaviors to use.

    Cheers,

    Dave.

  • jojoe,

    I got your PM but unfortunately can't reply (need 500 rep). I am very interested though but have a few questions for you I can't post my email in the this thread but if you look on my profile I have my Steam ID on there if you want to add me can talk through Steam.

    Thanks man!

  • Sorry to be a nag, how would I do something like this?

    [quote:2qn1e10g]you will need to make an in game editor, so you can draw the rooms back, and record the tile positions.

    I understand the tilemaps and I have a tileset already made. But I have no idea how to make an 'in game editor'.

    Thanks for your help man I really appreciate it, giving me a direct answer on the best approach is brilliant

  • jojoe

    How would I import my assets into C2 to make this array?

    Should I import my level layers as animation frames?

    Or would the layouts work?

    [quote:1cbok2cu]I can build multiple layouts in C2 using a tilemap and these layouts can be my level sections, I can then make a main layout for my game and use the other layouts as my level sections and just generate them that way

  • That looks very interesting

    My game is going to look pretty much exactly like the screenshot I posted above, each art board is a section of the level so the way I am hoping to manage the generation of them is to bring each level in but in a logical placement. So if there is a higher platform for the floor in one section of the level then the next section of the level will have to match that.

    I am hoping to do about 16 different variations of the level sections to keep things 'fresh' xD

    My problem is I am not entirely sure how to import my level sections in to C2. Whether I can bring each of the level sections in as an animation frame and use them like that, or I can build multiple layouts in C2 using a tilemap and these layouts can be my level sections, I can then make a main layout for my game and use the other layouts as my level sections and just generate them that way (I hope that makes sense haha).

    I am trying to figure out the usage of these level sections and what ways are the most efficient for mobile devices to be able to run my game. I am a little worried that I am going to make 16 of them in Illustrator and then find out they aren't usable haha.

    Sweet link though man thanks for that

  • Hi Guys,

    Here is an update on how I am going to try and attempt to procedurally generate my level for my infinite runner game.

    Each artboard is a 'room' or 'section' of the level. My plan is to spawn the sections at random, which may take some careful planning on how they are built which leads me to some questions. Before I ask my questions I just want to explain that when I export these images they are going to be used in various ways.

    The floor of the level is on its own layer which I am going to be making a 'Solid' when I bring in the level sections into C2. I plan on importing the sections of the level as layers e.g, FG_Solid = Floor, BG_Level = Background artwork for the level, FB_LevelElements = Decorative artwork such as the windows, barrels, crates, mummy caskets etc.

    When I import my layered artwork into C2 (this may be a stupid question), how should I import it in? As a tileset, an animation frame? The floor and threats in the level (moving saws, spikes, etc) are going to need collision so I am not to sure what the best way is to bring them into C2.

    My second question is, how much control can I give myself when it comes to coding the levels. Each artboard is a level which I want to spawn randomly to make an infinite level but I want the layout of the level to make sense. How can I code the logic of that to have complete control over what spawns next to what? I know that is a pretty broad question but if someone has some sort of formula or general idea on how to code the logic to control what section spawns next to another section I would appreciate a push in the right direction, otherwise I can try and figure it out myself xD

    Thanks for all the help so far though guys, this is an interesting topic and I hope if I get an efficient workflow for this kind of thing, I will definitely be sharing, may be a blog post or something

    Cheers,

    Dave.

  • ultrafop thanks for the links man very cool stuff.

    I had a rough idea on how I would have to do it and this just clarifies what I needed to know

  • Ahh yes thanks man!

    I see the templates. I think I may need to reconsider how I am placing down tiles as I can't think of how to place them down procedurally.

    The Flapping Bird template gives the illusion of an endless level by tiling objects and backgrounds, my level is a little different as there is tiles there but they are in chunks so I can use the tileset option to place them down into my layout.

    I may need to go into Illustrator and make sections of the level that are tilable and use those sections to move along the X of my player view to give the impression of an endless level. Unless there is another way to do it

  • Hi RamPackWobble.

    I have the Steam version of Construct 2 when I go to the example projects I don't see an infinite jumper or flappy bird game. Is it something I need to get from the Scirra store?