2D Toolkit Forum

2D Toolkit => Support => Topic started by: sturmburg on April 29, 2013, 02:12:03 pm

Title: Background Question
Post by: sturmburg 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.
Title: Re: Background Question
Post by: unikronsoftware 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.
Title: Re: Background Question
Post by: xhidnoda 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!
Title: Re: Background Question
Post by: unikronsoftware 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?
Title: Re: Background Question
Post by: xhidnoda 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?
Title: Re: Background Question
Post by: unikronsoftware 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 :)
Title: Re: Background Question
Post by: xhidnoda 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!
Title: Re: Background Question
Post by: mradebe_eti 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.
Title: Re: Background Question
Post by: unikronsoftware 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.
Title: Re: Background Question
Post by: wagenheimer 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?
Title: Re: Background Question
Post by: wagenheimer 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?
Title: Re: Background Question
Post by: unikronsoftware on August 31, 2013, 12:05:08 pm
Yes. One of them is the sprite collection. It gets deleted when the sprite is deleted.
Title: Re: Background Question
Post by: wagenheimer 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!
Title: Re: Background Question
Post by: unikronsoftware 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.