Search Unity

2d Pixel Clicker Game

Discussion in '2D' started by ulowbaer, Aug 14, 2017.

  1. ulowbaer

    ulowbaer

    Joined:
    Jul 13, 2017
    Posts:
    3
    Hello everyone,
    I actual try to create a pixel clicker game, but I still stuck with unity sprite scripting options.
    The idea of the game is, to have an image with a black overlay. The player has to click on the overlay to make the dark pixel invisible (so the click in a dark pixel and the behind pixel will appear).
    My problem is, that I have no idea, how to do this?
    I have tried a few different things with textures but nothing works (maybe I used the textures in the wrong way).

    Has anyone an idea how to solve this?

    Additional Information:
    I plan to use very very big images (not sure if unity can handle it..) so I don't thing, that creating millions of pixel instances is a good idea, is it?

    Thanks you very much
    Severin
     
  2. ulowbaer

    ulowbaer

    Joined:
    Jul 13, 2017
    Posts:
    3
    An alternative would be, to use fog of war (so i would use a secon camera).
    The clicked pixels could I store in a large 2d array.
    The challenge would be, to map clicks in fog of war and the array. Also if i want to have automatic uncover in the later game..
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,442
    Look for tilemaps, 2017 has builtin tilemaps, and asset store has plugins (with extra features) too.

    Or just create texture, set texture filterMode to Point, then paint into those pixels?

    You don't need separate overlay texture, just take values from array (so when black pixel is erased, take color value to that pixel from array)
     
    ulowbaer likes this.
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Or use PixelSurface (forum thread here). :) This sort of thing is exactly what it's designed for.
     
    ulowbaer likes this.
  5. ulowbaer

    ulowbaer

    Joined:
    Jul 13, 2017
    Posts:
    3
    Thanks for your response.
    Actual I solved this problem with changing spritee texture and apply the result.
    Now I will check the other solutions, because I expanded the clickfield to an very big picture (about 20.000x10.000 pixels). For that I split it into some subimages, but I worry that changing textures will kill the game performance.
    So I hope PixelSurface or TileMap can solve this issue.

    For Tilemap I need Version 2017.2, dont I?
     
  6. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Yes currently TileMap is in the Beta build.