Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - luniac

Pages: [1]
1
Support / Question regarding camera, physics constant
« on: October 16, 2015, 10:37:25 am »
In your thread:
http://2dtoolkit.com/forum/index.php/topic,1746.0.html

you say the general formula that works pretty well is
1. Work out the screen height in meters from the top to the bottom of your game window screen. Eg. if you can stack up 10x 1 meter boxes to fill up your screen vertically, then thats 10 meters.

2. Work out the camera height - if you're using an orthographic camera, it will be the orthographic size * 2. If you use a tk2dCamera, it will be the height of your native resolution in pixels.

gravity.y should be around = -9.81 * camera height / screen height meters for things to fall naturally.


Can you elaborate on step 2 cause im not sure i understand it.

I have a 2d toolkit camera in my scene that uses default orthographic projection with "Pixels Per Meter" type set to 100 pixels per meter.
My native resolution height is 1280 pixels.

so for "camera height", what do i calculate? im not sure what orthographic size is since i use pixels per meter, i don't really use "orthographic size" type.
do i use the resolution height?

i checked with a 1 meter box for screen height and got 32 meters. so i do -9.81 * 1280 / 32 = -392.  thats a pretty high value.

2
Support / Animation Events Example in JS
« on: November 28, 2014, 11:27:32 pm »

Hi, can i get a basic example of using animation events in JS?

The documentation code is in C#
anim.AnimationEventTriggered = HandleAnimationEvent;

    void HandleAnimationEvent(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNo) {
        tk2dSpriteAnimationFrame frame = clip.GetFrame( frameNo );
        Debug.Log( frame.eventInt );
    }



I get that i attach the script to the object with the spriteanimator but the example JS script doesn't have any event callback syntax, and I'm not sure how to do it.

http://www.unikronsoftware.com/2dtoolkit/docs/latest/tutorial/scripting_a_sprite_animator.html

Is there some simple way to check callback like:
OnAnimationEvent(eventdata : data){
 if(eventdata.info = FRAME3){
    CODE
 }
}


I just need a super basic example. Thanks :)

3
Support / Re: Using PNG atlas format breaks collection
« on: November 27, 2014, 12:58:29 am »
Sure,

All i did was,

1) create sprite collection
2) drag some textures in there and commit
3) change atlas format to png
4) create a sprite and select created collection and some sprite, it gives error.

I got screenshots:
capture 1 shows how the sprite looks like with the error(i havent been able to recreate the pink null texture)
capture 2 shows the error message when creating a new sprite using the broken collection
capture 3 shows the inspector view of the messed up sprite
capture 4 shows what gets created when setting atlas format to PNG
capture 5 shows the sprite collection settings
capture 6 shows the Unity texture format output which fixes everything

4
Support / Using spritecollections instead of resources.load
« on: November 23, 2014, 07:09:14 pm »
I know that resources.load can be used to individually load assets into memory in order not to overload it all at once in case there's too many assets to be used in the game at once.

So if I use a  sprite collection with loadable checked off, it wouldn't load the whole atlas into memory upon starting the game?

5
Support / Newbie question about atlases and drawcalls
« on: November 23, 2014, 07:07:19 pm »
So from my understanding if I have a sprite collection with a bunch of sprites using the same atlas material and I use only those sprites in a game, my draw call count should be 1.

What if I use 2 atlases with their own separate textures for whatever reason but both atlases use the same material. Will I still get 1 draw call in the game or does it count as 2 draw calls since both atlases have to be loaded into memory or something?

6
Support / Using PNG atlas format breaks collection
« on: November 23, 2014, 06:43:27 pm »
If I create a sprite and try to point to a sprite collection set to PNG format, I get a NULL error and a pink missing texture instead. What cases this?

Pages: [1]