2D Toolkit Forum

2D Toolkit => Support => Topic started by: gianluca on September 15, 2013, 08:58:31 am

Title: Nothing showing up in the Preview Window
Post by: gianluca on September 15, 2013, 08:58:31 am
Hi there,

I am using 2D Toolkit and trying something as simple as getting a sprite on the game window.
I have added a tk2dCamera and left all its settings to their default.
I have created a Tk 2d Sprite Collection and loaded up few images from an existing sprite sheet.
I have added a sprite to the main scene. I can see the sprite there, however the Game window shows just the default sky color (blue).

Any idea on what I might be missing?

thanks in advance,
Gianluca
Title: Re: Nothing showing up in the Preview Window
Post by: unikronsoftware on September 15, 2013, 09:23:03 am
Is the sprite inside the camera bounds?
What are the zvalues on the camera & sprite?
Title: Re: Nothing showing up in the Preview Window
Post by: gianluca on September 15, 2013, 11:51:05 am
camera: (0,0,-10) - clipping (0.3, 1000)

sprite: (0,0,0)


They should be the default values...

thanks again!!
Title: Re: Nothing showing up in the Preview Window
Post by: gianluca on September 15, 2013, 08:42:17 pm
Ok, I am really new at this and I am having some hard time to understand how the mechanism works.

Let's say I have a sprite, which is 60x60.

The default tk2dcamera is positioned at (0,0,-10) by default, native resolution 960x640, Fit visible, Camera resolution: 618x344. (What does all of this mean?!)

The sprite is at (0,0,0) and scale (1,1,1)... and I cannot see anything.

Could you briefly explain me how this works? I've gone through the documentation but I havent been able to find much..

Cheers!
Title: Re: Nothing showing up in the Preview Window
Post by: unikronsoftware on September 15, 2013, 09:36:22 pm
Hi,

Have you followed the tutorials?
http://unikronsoftware.com/2dtoolkit/doc/2.20/

By the end of the first set of tutorials, you should be able to create a sprite. Alternatively, look at the whack a mole tutorial tutorial (http://unikronsoftware.com/2dtoolkit/doc/2.20/tutorial/whack_a_mole/index.html) which should walk you through getting started.

Sprites are created at a particular size - whatever your camera size, the collection should be created at the same size. Otherwise you'll have to use "1:1" to resize the sprite to match the camera.

If you're new to all this the whack-a-mole tutorial should be quite useful - it should get you started and covers a lot of the basics.