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 - fryza

Pages: [1] 2
1
Support / Re: Screen Anchors for UI
« on: March 17, 2014, 05:24:36 pm »
I'm really going crazy here.

Can you help me understand what I am seeing here.

I don't want anything squished or stretched. When it is a tablet i want it to show the full background/screen size. When it is a phone, just clip the background on the left and right. I can't seem to get tk2dcamera to do that. Can you help me understand?


2
Support / Re: Screen Anchors for UI
« on: March 17, 2014, 04:09:51 pm »
Is it possible to use the camera anchors without using the tk2dcamera features.

My problem is i don't want any overrides and i dont want the camera to squish or stretch things. I just want a default orthographic camera. Im doing a mobile game and using the tk2dcamera i can not get every resolution to look good. It either squishes iphone 5 or makes ipad too small. I could add specific overrides, but we are also building this for android and a ton of devices.

What is the best practice here to support multiple resolutions?

The best fit so far has been to not use the tk2dcamera feature - i just place the objects at different places on the screen that support both phones and tablets and it seems to work great. But I need the camera anchors to do this.

So how can i turn off all tk2dcamera features while still using the anchors?

3
Support / Screen Anchors for UI
« on: March 14, 2014, 08:14:05 pm »
Is there a way to position items at top left, top middle, top right, bottom left, etc,etc,etc of the screen edges?

Something that supports both retina and non retina resolutions? Also something that has an x and y offset?

4
Support / Re: Possible Sprite ID Bug
« on: March 12, 2014, 11:59:17 pm »
That fixed it!!! Looks like its probably a bug!

5
Support / Re: Possible Sprite ID Bug
« on: March 12, 2014, 11:23:11 pm »
So here is this specific instance of steps:

  • Create 2 sprite collections (in my case the first sprite collection generated 2 data files for some reason)
  • A manager object in the scene has a serializable field array of tk2dSpriteCollectionData - make its size 3 and then drag the sprite collection data files into the slots
  • Cycle through the collection data objects and do a .name comparison for the name of the sprite in the first collection that has ID of 0 (so if the sprite name "sprite_a" has a sprite ID of 0 - that is the sprite you want to use
  • do sprite.Collection = theCurrentCollectionThatTheSpriteWasIn
  • do sprite.SetSprite(theStringNameWeCompared)
  • In my case the instantiated sprite shows ID 0 of the 2nd sprite collection

6
Support / Possible Sprite ID Bug
« on: March 12, 2014, 11:04:16 pm »
I have a sprite collection of thumbnail images. I then have 3 different sprite collections that together contain those same thumbnails, but as full size images.

When you select a thumbnail we need to get the same full size version. So I do this:
Quote
foreach (tk2dSpriteCollectionData data in currentTheme.SpriteCollections)
      {
         for (int x = 0; x < data.Count; x++)
         {
            string sName = data.spriteDefinitions[ x ].name;
            
            
            if (sName == spriteName)
            { //etc, etc

What we do is cycle through the sprite collections for that "group" of sprites and if we find the same named sprite lets do something with it.

The problem I'm having is on the sprites that have the ID of 0. What happens is "hat_sprite1" in collection 1 has an ID of 0, and instead of showing the hat sprite, it shows the sprite of collection 2 with ID 0.

I cannot figure out any way around this. I'm not even using IDs - just doing sprite.name comparisons.

Any ideas on how to get around this? Notice in the attached image that the sprite collection at the right is showing the proper hat image - but the one that actually shows in the viewport is a shirt.


7
Thanks!!!

8
I have a game where you drag clothing items on a character (2D Game).  We designed the textures so that they all have the same texture size, but with the appropriate drawings/art within those bounds. We did this so we could drag a texture and the center will always be 0,0,0 so we never have to reposition the items within the game.

The problem I have is that when we move the texture to the position of the touch on the screen, this happens at the anchor point of the texture (in the center middle). If I change the anchor point to be the center of the actual item our 0,0,0 positioning system no longer works because the anchor is different on each item.

So my question is this: How do I get the WORLD POSITION of the actual sprite within the texture bounds so I can move the sprite object to the position of the touch?

See screenshot for example. I basically want to do this: tk2dSprite.transform.actualspriteposition = touch position

So the user would touch the screen and the crown in the image would move to the touch position (the actual crown image would be under the users finger). Then when they let go of the item I need only to move the sprite (the outside bounds) to 0,0,0 and it is aligned perfectly.


9
Support / Change Anim Framerate dynamically
« on: May 06, 2013, 09:33:15 pm »
How do I change the frame rate of an anim programmatically?

I am currently using this code - but it is producing undesirable results (playing way faster than it should):

Code: [Select]
Track.CurrentClip.fps = 50;
Track.Play();

What I am trying to do is increase the speed for each level. It is a light that spins around and you try and stop it on the jackpot.

What I want it to do is increase: 38,39,40, etc

The speed DOES increase, but the results aren't steady and it plays much too fast. I have compared the speeds that play when I set this through the editor vs at runtime and the two speeds are not the same. Thoughts?

10
Support / Re: Button Colliders and Swipe Detection
« on: May 02, 2013, 06:52:20 pm »
Ahaa. I think I've found the issue. I kept clicking and dragging in the demo scene, and in the demo scene, it very quickly goes out of view. It breaks reliably when I drag just a tiny amount, and then let go - an event is fired then.

You should probably hack in a fix for now - I'll get it fixed properly in the next version.

Ive got a bandaid solution that makes this work and just wanted to share it with you for your reference - I'm not an elegant coder FYI.

In tk2dUIScrollableArea.cs in the method UpdateSwipeScrollDestinationPostion() if currTouchPosLocal.x equals swipeScrollingPressDownStartLocalPos - you are still counting this as a swipe, when no swiping is taking place - the coords are the same which indicate a "button click" with no swipe. So now I have put in a check to see if these two values are equal - if they are equal then it is a button press, if they are not equal it means we are swiping and we should not fire the button event.

Thanks for the awesome UI system!

11
Support / Re: Button Colliders and Swipe Detection
« on: May 01, 2013, 04:24:21 pm »
Just so I understand this correctly (I think I misunderstood your earlier request) - you click on the button, drag and then let go and it fires the button click?

That is correct - and that is what I DONT want it to do. I want it to work like a native iOS UIScrollview - where if you select a button in the scrollview but drag it, then let go, the button does NOT fire.

12
Support / Re: Button Colliders and Swipe Detection
« on: May 01, 2013, 03:29:25 pm »
I suggest trying the button from the tk2d UI system. It should work a lot better - there is a prefab in the UI system you can simply drag into your scene and customize.

I've been playin around with this still for quite a few hours with no luck. What am I doing wrong here to get this to work?

13
Support / Re: How to check the current animation frame via code
« on: May 01, 2013, 02:33:53 am »
Thanks for this. It works perfectly now.

14
Support / Re: Button Colliders and Swipe Detection
« on: April 30, 2013, 11:53:53 pm »
I have done what you mentioned but am still having the same problem. Please see attached video. Notice how I click on the icon and drag it around. Then I fling/release it. It should NOT load the next screen - but it does - it registers the event and it shouldn't.

It is a Tk2dUIitem. I have tried "On Up Method Name" as well as "On Release Method Name" - they both still call the function when dragging.

Like on a native iOS app - if I touch a button on a scrollview, but then drag it - the button no longer recognizes the touch event. On iOS for the touch event to be fired, it must be a distinct tap.

How do I achieve the desired result? Your scrollview works beautifully - but I need to figure out this one problem - I can't swipe buttons without their method calls being triggered.

Here is the video: https://dl.dropboxusercontent.com/u/109152337/Scroll_Problem.MOV

If the feature I need doesn't exist - can we just hack it for the time being? Maybe I can insert a static bool in your code somewhere that says, "isDragging" - then when the method is called, if "isDraggin" was true then I don't call the method.

15
Support / Re: Button Colliders and Swipe Detection
« on: April 30, 2013, 08:29:28 pm »
You could take a look at the 2D Toolkit UI system.
That supports swipeable lists + buttons...

You can download a beta from the Releases forum.

Hi - I implemented your UIScrollableArea and it works GREAT! Good work with that. I do have one request and am wondering if you can help me make the proper code modification. Currently if you touch down on an "button" in the content area, then start swiping/drag your finger off it doesn't fire - which is great. But what I also think should happen that when you touch down, the instant you start swiping the button no longer is active. I keep getting tons of accidental button fires.  I am using tk2dButtons in the content area. Do you have a different button I should use? I do need to call a method on an object.

So again - is there a way to make it so when an item is touched down, and the user starts swiping that the button can no longer be fired until the swipe has stopped and the user completes a touch up event.

Pages: [1] 2