How do I make proper conveyors?

0 favourites
  • 14 posts
From the Asset Store
Jump on alphabets in the proper order and reach the sun!
  • Hi guys,

    I am not 100% how to ask that so that you guys may understand, but let me try...

    I am busy with a building game, in which you can construct conveyors, My question tho is how can I change the frame of the conveyor depending on the point on which it connects, like on the corner or intersections of it.

    See the attached image for an example (From Factorio as a demostration), The red circles is what I'm trying to achieve:

    Any help, suggestions or ideas will be appreciated much.

    Thanks

  • Use a tillemap with round corner!

  • Thanks for the suggestion Nicolas, But I am not sure about what you mean by the 9-Patch unless I don't know something. You see each square of the grid is individual sprites and the sprites in the red circle frame are determined on what is next to it.

  • I think he's saying to use a tilemap object

  • Thanks for the suggestion Nicolas, … 9-Patch …

    Sorry my fault, I've edited, it's Tilemap and not 9-Patch… ^^

    So, a Tilemap, see example : dropbox.com/s/b3brayv7q5uh5z4/Tilemap.c3p

  • Thanks, Nicolas for helping me understand your idea.

    But it's not what I am looking todo, Basically, I have a sprite (Conveyor) with different Frames A corner frame, a line frame, and an intersection frame. And I can only place this sprite in a grid system.

    Once I start placing the Sprite (Conveyor) in my layout the Conveyor should determine on which frame it should be on depending on what is next to it, Like on the image with the red circles, if it there is 2 conveyors in close proximity to it, it should display the corner frame, if I delete one of the conveyors it should go back to a line conveyor.

    I hope this makes sense?

  • how is this all happening? user input? auto generation? or some automated process (a collision)?

    I would use a grid system, where you check the grid around the tile in question. I will try to mock up an example...

  • so do you want the code (EDIT: tile) to change automatically as you place the tiles down?

    drive.google.com/file/d/1TCXl-AbfSKZnyNha08a6QGWPBEABkniV/view

  • I'll attach a version of my game that I scrapped as it had ***** of issues (This version was extremely far from completion), laggy at times and the fact that I thought I could do much better. I am busy making a new better version of the game tho.

    In the game, you will see how the input and output suppost to work, As per my previous reply I am just trying to make the conveyors have like connected textures if I can put it that way.

    The scrapped game link XD (It is suppost to be played on Portrait mode in android so some touch features may not work) cranky-bose-e2f229.netlify.com

  • so do you want the code (EDIT: tile) to change automatically as you place the tiles down?

    https://drive.google.com/file/d/1TCXl-AbfSKZnyNha08a6QGWPBEABkniV/view?usp=sharing

    It's like that yes, but as you place the conveyor it should automatically dictate which frame to display depending on what is near in and in which angles.

  • I see what you're wanting to do.

    I assume you have these tiles as some sort of grid. What you'll need to do is to do something like a for loop. You'll have look at the grid the tile was placed on, then look at the grids x-1, y-1 to x+1, y+1 and see if there are any other conveyors on those grids and change your sprite depending on where the other conveyors are.

    But, you have other problems. What if a player puts down a conveyor like this

    0X0

    X0X

    0X0

    Where x are conveyors and 0 are empty.

    Now, what if the player places the next one in the middle of that grid?

    My suggestion is to 'guess' at what the player wants but also give them the ability to rotate the conveyors.

    The easiest solution:

    Have straight conveyors and curved conveyors. Allow the user place whichever they want and give them the ability to click on those conveyors to 'reverse' direction and click another place to rotate them.

    One thing to consider, and this comes from a game TerraTech which also uses conveyors, when they click to reverse, it reverses all connected conveyors.

    *edit

    Still thinking about it, you're also going to need some way to determine which ends of those conveyors will be able to 'connect' to others. For example, a straight conveyor can connect to y-1 and y+1. If it gets rotated then it's x-1, x+1. Curved might be y-1, x+1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you need a "ruleset" to figure what happens in each scenario. As you place the piece you are going to have to check all adjacent pieces and figure out if their orientation is correct or not.

    It's not going to be easy, but it is certainly doable.

  • Exactly what I was trying to say. I just used wayyyy to many words.

  • Thanks guys for your suggestions,

    I am going to try using an Array to read and write from to determine where is what.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)