Hello Guest

Author Topic: Background Question  (Read 10420 times)

sturmburg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Background Question
« on: April 29, 2013, 02:12:03 pm »
Hi,

New to 2D toolkit and had a question about backgrounds in a side-scroller.  If I have a single image I want to use as the background, what is the most efficient way of displaying it?

thanks for any info.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #1 on: April 29, 2013, 02:46:00 pm »
The most efficient way to do this is likely to use runtime sprite collections. Check sample #13 for more info on how that works. This is to avoid having to create an atlas or anything else.

xhidnoda

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Background Question
« Reply #2 on: June 27, 2013, 04:39:23 am »
hi!
i get a issue with my background. The background over pose to my sprite when play the game prototype.
The Z axis of my sprite "the wall Stone" is 10.80086
The Z axis of my background is 52.88598
The camera i use is default of unity, Perpestive view
Soo...don't get what the problem here.

Can help me pls?
Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #3 on: June 27, 2013, 11:47:23 am »
Well you didn't say you used a perspective camera :)
Have you tried calling MakePixelPerfect on the sprite after you create it?

xhidnoda

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Background Question
« Reply #4 on: June 27, 2013, 03:06:39 pm »
thanks for reply to soon :)
I am in my work now, in the night i see the MakePixelPerfect is check o create.
This issue only happen in 2D toolkit 2.0 not in 1.9 version.
Unikron...can you says what camera is more recommended for game 2D?
In my case i use camera default of Unity and perspective, because i get a parallax effect whit my background and my sprite on front.
can you?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #5 on: June 27, 2013, 04:19:22 pm »
If you want to use a parallax camera, thats fine, but you just need to call MakePixelPerfect once. The checkbox is not present in tk2d 2.0, but all you need to do is click "1:1". As long as you don't move it in z then it will always be fine :)

xhidnoda

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Background Question
« Reply #6 on: June 28, 2013, 03:28:32 am »
yep..clik the 1:1 is a option to solved this problem...but destroy all scale of my sprite.
So for now a set the camera the "far" value to more!
Thanks!

mradebe_eti

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Background Question
« Reply #7 on: July 05, 2013, 06:48:08 pm »
Hi,

I'm also new to 2D toolkit. If I have a single image I would like to use for my background, how do I set it up?

Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #8 on: July 05, 2013, 10:54:22 pm »
In 2D Toolkit 2.0, select the background image in project window, and in hierarchy window, Create > tk2d > Sprite from selected texture. Set up the camera settigns and you're good to go.

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: Background Question
« Reply #9 on: August 31, 2013, 02:01:09 am »
And there is a way to resize the background to it's original size?

My background is 1280x720 (My camera also has this size)... But when I create a sprite from it, I got a 1024x512 texture.

How to resize it easly to it's original size and make it fits all my camera view?

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: Background Question
« Reply #10 on: August 31, 2013, 02:02:31 am »
And why it's create on my scene a Sprite and a tk2dSpriteFromTexture - background01?

I must keep both?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #11 on: August 31, 2013, 12:05:08 pm »
Yes. One of them is the sprite collection. It gets deleted when the sprite is deleted.

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: Background Question
« Reply #12 on: August 31, 2013, 08:02:21 pm »
And the other question about the Original Texture vs Sprite Size?  :)

I must be doing something very wrong!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Background Question
« Reply #13 on: August 31, 2013, 09:07:01 pm »
That sounds very much like your texture importer setting is set to "Texture" and not "GUI". Set it to GUI or manually enable non-power of two textures for it to be the correct size.