2
\$\begingroup\$

Color Connecting Platform to Platform

enter image description here

[UNITY] As you can see above a solid color is connecting one platform to another. My question is whether this color must be applied through code or through a sprite. In my game there are three lanes and for each platform you land on, it must connect the color to the platform...and so to put that into sprites seems to be a bit numerous...in my opinion with varying vertical and horizontal distances between the platforms it will much too difficult to make each individual sprite (as they also are of varying colors).

Hopefully, the above explains my dilemma well enough. Would anyone be so kind as to guide me through this?

\$\endgroup\$
  • \$\begingroup\$ This looks like something I would do with a procedural mesh. Is that the kind of solution you are looking for? \$\endgroup\$ – Philipp Jul 10 '16 at 23:27
1
\$\begingroup\$

There are lots of ways you could solve this. Here are two...

  1. Have one sprite that's a triangle, and another that's a solid rectangular fill. You can then form roads between platforms using a combination of these two sprite shapes. Here I've tinted them in different colours to show the construction:

Platforms bridged by coloured triangles and rectangles

  1. You can write a script that uses the Mesh class to construct a new mesh whose triangles exactly fit the gaps between your platforms. Each bridge would need four corner vertices, and six indices joining them in the order (bottom left, top left, bottom right, bottom right, top left, top right)

Platforms bridged by a triangle mesh

\$\endgroup\$
  • \$\begingroup\$ Thank you so much! I'm not entirely sure how to implement this but I appreciate this a heap! Again, thanks so much~ \$\endgroup\$ – user78705 Jul 12 '16 at 3:22
  • \$\begingroup\$ Implementation questions are what StackExchange excels at, thankfully. Which method are you trying to implement, and where are you stuck? \$\endgroup\$ – DMGregory Jul 12 '16 at 3:39
  • \$\begingroup\$ Currently, I am implementing design elements to the game. To be truthful, I'm putting this procedural mesh off until as long as I can but as soon as I stick myself, I hope that you will be here to guide me a little bit through. \$\endgroup\$ – user78705 Jul 12 '16 at 22:44
  • \$\begingroup\$ Thank you so much! I drew them with the mesh class and just changed the material to a copy of the sprite-default to get the color right. (If you're ever interested, I'd like to send you a beta of the game as soon as it's available) Cheers:) \$\endgroup\$ – user78705 Jul 19 '16 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.