Search Unity

how create a coloring in game in unity

Discussion in '2D' started by mirikay, Aug 17, 2014.

  1. mirikay

    mirikay

    Joined:
    Feb 27, 2014
    Posts:
    1
    I'm creating a coloring game where they can colour anywhere on the image except for a certain section. Can I get help to lead me in the right direction Please? thanks in advance =)
     
  2. Punchbag

    Punchbag

    Joined:
    Oct 30, 2012
    Posts:
    48
    It may not seem like it, but this is actually a tough game to build if its your first game, especially in Unity.

    You see, the simplicity of Unity comes in the fact that you're working with objects and components of those objects, for the most part, but what you want to do involves ignoring all that and working with textures and graphics processes directly.

    If you want to tackle it head on, though, check into these topics:

    • Render to Texture (A texture is an image in memory, either loaded from file or created like a blank canvas)
    • Render Buffer (really just another name for the target texture)
    • Shaders (The code for graphics cards that does crazy stuff really fast)
    • Masks (Lets you prevent certain areas getting painted to)

    The general approach is, on click or drag, render the paintbrush texture to the canvas buffer texture, and; Every frame, draw the canvas buffer texture to screen.

    That's the core of painting on click, you can then expand to use different paintbrush textures to get different basic shapes / masks to prevent painting certain areas / shaders to make different effects.

    Good luck!
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411