C
C#8mo ago
Kaenguruu24

Conveyor Placement System

I've been looking around but all I can find are solutions on how to move items on conveyors. However, my struggles are currently on how to make a placement system that works for me. Here is how it should work: You select an input object (imagine it as a button). From there you can move your mouse to a dot in a grid where you want to place the first part of the conveyor. As long as you left click somewhere, you add the current mouse position (snapped to a grid) as part of the conveyor and then you can set the next point. When you select an output, it will add the output to the conveyor and stop. Now, if you want to add a second output, you can click anywhere on the conveyor (again snapped to a grid) to "extend" the conveyor from there. Some things it also needs to do: Snake-like behaviour, so never in the opposite direction of where you are coming from. Other belts can cross anywhere. My main issue right now is that I'm unsure how to setup the code. I already have a version, but it just adds the points to a List<Vector2> and then draws them in order. So if the list looks like this: [Vector2(0, 0), Vector2(100, 0), Vector2(100, 100)] it would draw from (0,0) to (100,0) and from (100,0) to (100,100). This works as long as we ignore point 4 because my current implementation does not allow for multiple connections. Honestly, it all looks a bit like how you would model an NFA so maybe that would be an approach? Any help is appreciated.
1 Reply
SpReeD
SpReeD8mo ago
This could be a starting point, or could help you with the structure: https://github.com/spreedated/transportbeltVisualizer
Want results from more Discord servers?
Add your server