Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Trying to avoid black bars for pixel art games

Discussion in '2D' started by DigitalPanda, Aug 26, 2016.

  1. DigitalPanda

    DigitalPanda

    Joined:
    Mar 9, 2015
    Posts:
    9
    Hiya, so I've been working on a runner style app, and i decided to use my own pixel art. I didn't think using pixel art would be so hard ;_; I was finally able to get everything to "snap" together without any weird effects or subpixels (using pixelperfect . I'm currently targeting 512x384 (1024x768) as that seems to be a fairly popular resolution (if this is a bad choice let me know please). Obviously using black bar to meet other resolutions isn't ideal, so my plan was to have the stalagmites and stalactites "hug" the top and bottom to meet taller resolutions and just have more play space to the right be visible for wider resolutions. (should be able to see what i mean in the pic) 無題.png
    It should probably be noted that the stalagmites/stalactites move in a kinda parallax manner and are spawned at a parent spawn position. I've been trying to use a canvas to hold them in place, but that doesn't really seem to be working (i could just be doing it wrong though, im still quite uncomfortable with much of unity's UI stuff). If anyone has done this before, or knows how to do it, it would be so appreciated if you could share the knowledge. Anywho, if any of you guys have any ideas or comments to share that would be great. And thanks in advance :)
     
  2. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    Are these objects in your game UI elements like UI Image that you are manipulating or just 2D sprites your adding into the scene? How are you currently positioning the elements?

    Without knowing that I can't give you specific instructions on what to do. But in general what I would do is create some more stalactite artwork that is rectangular in nature but would fit naturally underneath the current images you have. (or above them for the stalagmites). Then when your games starts figure out the screensize. Make sure your game as it is now is centered in that screen. If its bigger than 768 up and down figure out your offsets. Then just create a bar of on the top and bottom filled with the new square stalagmite image stretched across the bottom and top. So you'll still be using a black bar.. but it just won't look like it.

    Additionally you could try just scaling all your sprites globally up to a certain % to fit the screen correctly. After too much scaling though it might look bad due to lack of detail. Your options then are to tell Unity to force the game to set resolution, or if you want to give the user the option for higher res, create a set of higher resolution sprites. Say your gnome is 64x64.. then if you detected a high enough resolution you'd load in your 128x128 gnome instead.
     
    Last edited: Aug 26, 2016
  3. Zaflis

    Zaflis

    Joined:
    May 26, 2014
    Posts:
    438
    Depends on how you want to play it. That sounds like a game for windowed mode only. Most monitors today, and especially mobile phones use only widescreen resolutions, such as 16:9 or 16:10. My own monitor is as wide as 19:10 (1920 x 1080).

    It sounds like you are using the Unity UI to make the game. It's not a bad choice and gives you much control over how the game looks on all resolutions.