Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Orthello 2D Framework - 100% FREE

Discussion in 'Assets and Asset Store' started by mas, Jul 7, 2011.

  1. Nomad72

    Nomad72

    Joined:
    Oct 25, 2011
    Posts:
    117
    No, that makes perfect sense.

    I have come across two other things I'm not sure about in Orthello:

    1) directional lighting doesn't seem to be necessary, and spotlights appear to have no effect, so I assume Orthello makes some sort of change to the settings or uses a certain shader or whatever. What if I want to use a spotlight?

    2) I'm having some resizing issues when instantiating prefabs. For instance, I have an explosion animation saved as a prefab. The prefab is set to have a scale of 100x100, but when I instantiate it through script it changes the scale back to 64x64 as soon as the animation actually plays (I've tested this by changing the "play on start" setting). Even if I explicitly set the size in code, it reverts back to 64x64 as soon as the animation starts playing. Is this supposed to happen, and how do I get around it?

    Sorry for all the questions!
     
  2. tqnst

    tqnst

    Joined:
    Jul 2, 2012
    Posts:
    6
    I have a problem when restart game : When I use Application.LoadLevel("Game") command, my application appear a message error : MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it. "The object of type 'Camera' has been destroyed but you are still trying to access it"

    Somebody help me

    Thanks
     
    Last edited: Jul 13, 2012
  3. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    The thing you are experiencing are caused by the implemented 'painter algorithm'. (http://en.wikipedia.org/wiki/Painter's_algorithm)
    This algorithm takes the x/y positions into account when determining the actual sprite's depth when sprites are at the same level.
    So the real depth(z) value calculated to sprites are ordered back (top-left) to front (bottom-right)

    The disable this algorithm .. ( sprites will stay on the same order , independent of the x//y )
    you can set OT.painterAlgorithm = false;
     
  4. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello uses the approach that 1 Unity3D unit = 1 pixel .. and it adjusts the camera size to reach that goal.
    If you would like another size to be pixelperfect ( in your case 1 unit = 64 pixels ), you will have to calculate
    your custom camera size and set OT.view.customSize to this value

    .. before adding sprites to your scene.
     
  5. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello uses light ignoring shaders in the default 'transparent', 'solid' ', alpha', and 'tint' materialReferences. It is easy to expand the material system, so that sprites can use your own specific shaders.

    Read : http://www.wyrmtale.com/orthello/using-OT#materials , about info on how to extend the material system with your own custom materials.

    I have already solved some 'animation resizing' bugs in my version ( is not released yet ), and I am planning on releasing that version soon.
    That should improve things regarding auto resizing.

    ( if you send me an e-mail : info at wyrmtale dot com, I can send you a pre-release to check. )
     
  6. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    There is a 'fixed' bug in your version regarding persistance. This will be solved in the next coming update, but in the mean time ....

    change the void OnLevelWasLoaded(int level) method in OT.cs (line 2194)
    to

    Code (csharp):
    1. void OnLevelWasLoaded(int level)
    2.     {
    3.         for (int o = 0; o<persistantObjects.Count; o++)
    4.         {
    5.             OTObject obj = persistantObjects[o];
    6.             if (obj!=null  obj.gameObject!=null)
    7.             {
    8.                 _Register(obj);        
    9.                 if (obj.registerInput)
    10.                     _InputTo(obj);
    11.             }
    12.         }
    13.         _inputCameras = new Camera[] {};
    14.     }
     
  7. Nomad72

    Nomad72

    Joined:
    Oct 25, 2011
    Posts:
    117
    Mas, thank you for your responses - very useful indeed!

    A question about shaders : if I were to change the shaders to allow my objects to respond to a spotlight, would this have a significant impact on drawcalls? I was doing some tests with a spotlight on a non-Orthello scene (and not using atlas maps at all) and the drawcalls were incredibly high. I'm assuming the effect would be similar if I were using the Orthello framework? If so, I either need to change the game mechanics to avoid spotlight use, or I just need to accept that this project is going to be for PC only since the drawcalls will be way too high for mobile devices.
     
  8. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I would be dishonest if I said I knew...

    To test it you could .....

    1. Create a new material reference 'myMaterial' using a custom material with the desired shader.
    2. Create 2 sprites .. one with the myMaterial materialReference and one with transparent.
    3. Put in your light.
    4. Run and check your drawcalls
    5. Now disable each sprite seperately while running. The changing of drawcalls will give you the information you seek.

    GL
     
  9. GeneralV

    GeneralV

    Joined:
    May 29, 2012
    Posts:
    21
    I have some code that swaps the "flippedHorizontal" boolean on certain collisions.

    The code runs fine, but every time it swaps, it generates this error message:

    "Destroying object immediately is not permitted during physics trigger and contact callbacks. You must use Destroy instead."

    (It is in a physics trigger call)

    The code works as expected (at least with my current frame rate), so my question is: should I be worried about this error?

    Actually, I just poked around in the code. I found what is either a bug or an extraneous if statement.

    Starting Around
    OTObject: 1982

    Code (csharp):
    1.  
    2. if (Application.isPlaying)
    3.                     DestroyImmediate(mesh);
    4.                 else
    5.                     DestroyImmediate(mesh);
    Changing the first method to Destroy(mesh) seems to have stopped the error from being spammed.
     
  10. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I think changing the DestroyImmediate to Destroy (when IsPlaying) will not cause any problems in the
    framework .. so keep on going .. I will implement your fix.
     
  11. King-Kadelfek

    King-Kadelfek

    Joined:
    Mar 8, 2010
    Posts:
    18
    I would like to display only a part of a texture. I'm not talking about a spritesheet or an atlas, I would like to use coordinates, such as (x, y, width, height).
    I made a schema to explain :



    I don't find a way to do it with Orthello. Is it possible to do it currently in editor ?
    If it's not possible to do it in editor, what is the best way to do it with Orthello functions (to keep maximum efficiency) ?

    Thanks in advance.

    EDIT : replaced picture link.
     
    Last edited: Sep 24, 2017
  12. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Clipping a sprite is (not yet) implemented in Orthello. It is on my todo list though. Cant give a ETA however.

    You will have to use a custom material ( and calculate/set the right texture scale+offset yourself ) to achieve that
    effect.
     
  13. GeneralV

    GeneralV

    Joined:
    May 29, 2012
    Posts:
    21
    In the mean time, I've been building each piece of the sprite into a "frame" via TexturePacker, and then setting each individual sprite up as an animation so I can use an OTAnimatingSprite. It's inelegant, but it works.
     
  14. GeneralV

    GeneralV

    Joined:
    May 29, 2012
    Posts:
    21
    There's a similar error when you try to toggle an OTObject's collidibility in a collision delegate, but it seems to lack an "isPlaying" check. Method starts OTObject 1197; don't know if it's worthwhile to fix or not. I was trying to test something else when I stumbled on it.

    In other questions: how do I remove a method from an OTDelegate? Or, perhaps more simply, clear all attached methods entirely? Trying to remove an OnCollision delegate but keep the object visible (and collidible).

    Edit:
    Just found out the reason it wasn't working was because... I didn't save my script after adding OnCollide = null... Carry on! :embarrassed:
     
    Last edited: Jul 18, 2012
  15. Ishkur

    Ishkur

    Joined:
    Nov 18, 2011
    Posts:
    26
    Hello, I'm having difficulty creating TextSprites at runtime and couldn't find documentation in the class reference on the textsprites.

    Firstly, I tried to use
    Code (csharp):
    1. OT.CreateObject(OTObjectType.TextSprite)
    but after looking at the base script, OTObjectType doesn't recognize a TextSprite class.

    So then I just created a regular Sprite at runtime, added the OTTextSprite script component, and then removed the OTSprite component, but then that removes the mesh for the object.

    I've managed to create a TextSprite through code is by creating an Empty and added the OTTextSprite script to it. I'm wondering, however, if there is a "more correct" way of doing this.
     
    Last edited: Jul 18, 2012
  16. King-Kadelfek

    King-Kadelfek

    Joined:
    Mar 8, 2010
    Posts:
    18
    I spent a lot of time developing 2D games, so I'm interested by this feature. Thanks for the tip. :)


    I was thinking about a solution of this kind (TexturePacker or Atlas). I think I will test is also. Thanks.
     
  17. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    You are right.... I did not add the latest sprites into the OTObjectType yet .. silly me!

    In the mean time ...

    You could create a 'prototype' OTTextSprite into your scene .. name it for example 'TextSpriteProtoType' .. and put it under OT.prototypes in your scene's hierarchy. It will be automaticly 'de-activated' when the application starts.

    to create a new instance of this prototype textsprite simply call

    OT.CreateObject("TextSpriteProtoType");
     
  18. Ishkur

    Ishkur

    Joined:
    Nov 18, 2011
    Posts:
    26
    Thank you!

    In retrospect, it should have occurred to me to use an OT Prototype, sorry for bothering you with such a simple question that is answered in your documentation.
     
  19. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Nothing to bother here ... If you have a question .. dont hesitate .. just ask away ..
     
  20. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Latest version 2.1 of Orthello (Free + Pro) has the latest sprite types : GradientSprite, TextSprite and Scale9Sprite added to OTObjectType. Version can be downloaded from our website, and the latest will probably be accessable from the AssetStore soon ( submitted today ).

    In addition some bugs regarding scaling, scene changes, OTFilledSprite materialcache and more .... were fixed.

    Also added

    Sprite Creation : OT.CreateSprite("mySprite");
    to replace : sprite = OT.CreateObject("mySprite").GetComponent<OTSprite>();

    Sprite Lookup OT.Sprite("mySprite");
    to replace : sprite = OT.ObjectByName("mySprite")
    or sprite = GameObject.Find("mySprite").GetComponent<OTSprite>();

    there is also a OT.AnimatingSprite("myAnimatingSprite"); OT.TextSprite("myTextSprite"); for quick type casted lookups.

    Regaring Pro
    In addition to the above the 'lost' script execution order was re-instated so the paralax scrolling background
    is now scrolling smoothly again, without any errors.
     
  21. SyDaemon

    SyDaemon

    Joined:
    Apr 2, 2009
    Posts:
    23
    Hi mas,

    Thanks for the wonderful work on Orthello!

    I've noticed that for the object parenting to work properly, meaning the children gets scaled down appropriately after getting attached to another object as a child so that the relative scaling still works, one has to make sure all objects are part of the prototype list. Is there a way to replicate this behaviour at run time for an object created from the basic sprite (using OT.CreateObject(OTObjectType.Sprite)) with its settings all set also at run time? The scale of the children doesn't get automatically adjusted to retain their original size otherwise.

    Edit: Seems like it's done at the Unity's level. The way to get around this it seems is to downscale it myself by (child's scale / parent's scale) after setting the newly created stuff as children. I'm still not sure why it isn't applied for creating from the Sprite prefabs but happens for prototypes though.
     
    Last edited: Jul 25, 2012
  22. GeneralV

    GeneralV

    Joined:
    May 29, 2012
    Posts:
    21
    Hey, Martijn - haven't downloaded the new version yet, but the new OT.Sprite and OT.CreateSprite look wonderfully useful. (I assume you can cast the result to AnimatingSprite or whatever else, but I haven't played around with it myself, yet)

    Anyway, got a question for you:

    Is there a simple way to unhook the sprite's collider from the size of the texture it's showing? I've got a sprite that's got a lot of empty space that I'd like to ignore for collision purposes. (I can do this programatically, I think, but it'd be a pain)

    Example:

    ( http://imgur.com/FKwWw if the image doesn't show up.)

    Red is the auto-calculated collider of the sprite, Blue is the collider i'd prefer to create.

    As is, you can't seem to set the collider manually.

    Is it currently possible to set two OTSprites on one Game Object, currently? (A 100% alpha texture for collision and a normal sprite for viewing) That'd be another way to resolve it.
     
  23. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! Thanks for the wonderful framework, I bought pro and will now implement it in my project which uses tilemaps (heroes 3 like). I see that I'll have to write few functions myself, thought I wonder where to start.

    I'll use map as real game maps i.e. it will have moving dynamic objects, is it possible for me to manually add dynamic object layer into existing map?
    I guess I should re-assign OTTileMap.layers to somethings like OTTileMap.layers+1 extra layer?

    Also, if I want to move dynamic map objects, I guess I'll have to simply swap tiles of that layer in places. Is that the most easy way to do the task?
    maybe I should place dynamic objects on top of TileMap at all (without adding extra layer or anything), and sort all sprite objects manually using depth?

    I'll be gratefull for any recommendation on how to approach my task
     
  24. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I dont really understand the problem you are describing, but I seldom use the basic prototypes to generate sprites with childs from scratch. My usual practice is to setup prototype objects ( read sprites , animating sprites, fully configured and with childs and stuff ) and put them into my scene under OT.prototypes (in the scene hierarchy).

    This way I can simply create a sprite instance using OT.CreateSprite("myCustomSprite"); and it will have all it previously configured and scaled childs with it.
     
  25. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Yeah, I got really annoyed with the long GetComponent<> stuff. OFC you can cast the OT.CreateSprite("myCustomSprite") as OTAnimatingSprite.
    For looking up purposes I created a type based lookup method for each sprite type .. so ..

    OTAnimatingSprite spr = OT.AnimatingSprite("mySprite");

    should work.

    You can actually.

    * Set your sprite to Register Input and/or collidable so a box collider is added to your sprite.
    * Set physics property to 'Custom'
    * Manually adjust your collider settings (center, size )

    you could even drop the collider and add for example a mesh collider that
    will be used instead of the default.

    Physics 'custom' will not touch any collider.

    Two sprites on 1 GameObject will not work. However since parenting is working now
    you can...

    * Create a base 'parent' sprite object, size (1,1) and disable the mesh renderer
    By setting the size to (1,1) this will only function as a empty parent. You could even set
    draggable on this parent, but if you do dont forget to adjust the size of the (1,1) collider

    * Add your 2 sprites as childs of this parent sprite

    You can now move both sprites using the parent and still have control over look,
    feel and colliders of the children sprites.

    Makes any sense?
     
  26. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    The OTTilemap is really meant to be an import from the TILED.exe Tilemap editor. I did not put much time in making it adjustable or changable. However, in the example included in the pro you can find the code on how to change tiles. This way you could even move tiles across the grid, but only at tile grid positions.
    If you export a big empty grid from TILED, you could even set all tiles by code with the same technique :
    just setting tile id's

    However...

    I think your best approach would be to create 1 or 2 OTTilemap objects that you create in TILED for the backgrounds and other stuff that is really tile based and static. Move your 'static' dynamic sprites into a spritebatch on top of that. Add your dynamic objects as sprites on top of all other stuff.

    When placing single sprites at the same depth (== layer ). A painter algorithm is used to order them from top-left (back) to bottom-right (front)
     
  27. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Thanks for the answer, mas! That is how I thought too, so I'll go forward little by little adding missing functionality, and I'll keep tile map only for what it is intended - static backgrounds
     
  28. GeneralV

    GeneralV

    Joined:
    May 29, 2012
    Posts:
    21
    Yes, perfectly. Should work dandily. Thanks!
     
  29. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    I wonder what is wrong, see screenshot:



    Left is default view inside Teled editor (latest stable 0.8.1 Tiled build) for sample map desert.
    Right is how it looks in Unity now when exported as xml.

    Example maps supplied with Orthello Pro works fine, I looked through sources, desert example map is almost identical in terms of everything, xml structure wasn't altered. I wonder what might be wrong?
     
  30. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    I've been trying out the free version along with someone, and we've both run into a weird camera issue when simply following a tutorial.

    Here's what we do:
    -Set camera to orthographic
    -Add OT to project
    -Add sprite sheet container and set it up
    -Add a few sprites, possibly animated, but not important

    When in the scene view things look fine, but in the game view everything is mirrored. Rows of sprites which started on the left now start on the right. Moving the camera from -1000 Z position to +1000 fixes this, but the camera will soon flip again. Anyone else run into this?
     
  31. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Can you send create an example package and send it to info at wyrmtale dot com. I will take a peek and check wat is wrong
     
  32. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I have never seen this issue... The orthello camera will always be positioned at z -1000, that its fixed location. Seems to me that your camera is setup wrong. Maybe setting it manually before adding the OT main object has caused your strange behaviour. One thing is sure.. Your camera setup is wrong.. Rotation Maybe?

    To start a new scene, i usually....

    1. Create a scene
    2. Add OT main object ( let orthello adjust your camera )
    3. Thats it.

    Let me know if this works for you.
     
  33. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    I figured out one way that solves it - just had to change the direction I'm looking at the scene from in the Scene editor view :)



    It somehow feels wrong to see "Back" there, but three clicks on Z instead of one sorted the problem.
     
  34. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Because Orthello uses the carthesian coordinate system, the y-value is from top to bottom and the x-value is from left to right. So the image you show is the right camera orientation.
     
  35. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    Cheers, that's what I'll tell others who currently are working through this with me :)
     
  36. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Found and solved .. problem was the fact that OTTileMap was not supporting the Tileset's margin and spacing.
    Got that implemented and fixed some other layer uv mapping bug.

    U Got Mail!

    If you confirm the fix, I will put an update of the package online for all Pro users.
     
  37. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Thanks a lot for a quick fix, mas, all now works like a charm.
    Regards,
    Konstantin.
     
  38. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
  39. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Mas, I wonder, is there an easy way to access single tile?
    I was thinking to disable some layers when I need.
    I can get all layer tiles ids as they are stored in array inside every layer, and then I was thinking to set display to false. But I can't find a way to get access to tile using its id stored inside layer.

    I tried making lookupTile dictionary public variable, but when I try to access map after it is rebuilded, lookupTile count is always 0. Somehow from code I've got impression that it should hold references to every single tile, am I wrong with that?
     
  40. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    The code below is from the Example - Pro 6 TILED - Tilemap support

    Code (csharp):
    1.  if (GUI.Button(new Rect(20, 130, 170, 27), "Change Sewer Tiles"))
    2.         {
    3.             // first lets find the serwer layer
    4.             for (int i = 0; i < tilemap.layers.Length; i++)
    5.             {
    6.                 OTTileMapLayer layer = tilemap.layers[i];
    7.                 if (layer.name == "Sewers")
    8.                 {
    9.                     // now change all tiles to the same sewer ( sewerIdx )
    10.                     for (int t = 0; t < layer.tiles.Length; t++)
    11.                     {
    12.                         // we hard coded the firstGid (17) of the tileset that
    13.                         // contains the sewer tiles but we could have done a lookup
    14.                         // just call me lazy!
    15.                         if (layer.tiles[t] > 0)
    16.                             layer.tiles[t] = 17 + sewerIdx;
    17.                     }
    18.                     break;
    19.                 }
    20.             }
    21.             // adjust the sewerIdx so that will will be rotating the
    22.             // sewer tiles when this button is pressed repeatingly
    23.             sewerIdx++;
    24.             if (sewerIdx == 4) sewerIdx = 0;
    25.             // We need to manually rebuild the tilemap
    26.             tilemap.Rebuild();
    27.         }
    As you can see, you could find the right layer and just simple change the id's of its tiles.
    An ID of 0 will clear the tile.

    If you would like to hide a layer with all its tiles you could

    Code (csharp):
    1.   // first find the layer you need
    2.   layer.included = false;
    3.   tilemap.Rebuild();
    4.  
    Hope this answers your question
     
  41. Liger

    Liger

    Joined:
    Jul 31, 2012
    Posts:
    2
    I'm gonna sound exceedingly dumb here, but I've got the OT.CreateSprite in my Start function, and it's creating an infinite number of the sprites based on my prototype as though it were in the Update function.

    Code (csharp):
    1. void Start () {
    2.     OT.CreateSprite("test1");
    3. }
    It's literally just that, so I think I'm using it wrong. Sorry for such an easy question.
     
  42. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! Thank you for explaining tiles, I'll continue working with tiled much more later now, so no more bugging questions with it :)

    I had animation set up with around 56 frames, it all played fined. (it had default frameset with no name set)

    Now I decided to bring in animation names. So I expanded frameset to aroun 9 sets, gave names e.t.c

    And suddenly I get this:

    A


    I think all frames I set are in correct range. What might be the suspect?
     
  43. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    When this command in a Start() method is creating an infinite number of sprites, the only real reason can be that by calling OT.CreateSprite("test1"), a test1 sprite is created that calls the same method recursively. Further deduction lets me to believe , that you have put this code in the start method of a custom script that you added to the test1 sprite prototype.

    By creating a test1 sprite it would fire up the Start() method and thus creating another test1 sprite etc etc etc.....

    To solve it you have to remove this script from the test1 sprite prototype and add it to some neutral component, the main camera for example. You could also create an empty game object, rename it to 'game' or 'application' and add your custom script to that.

    Hope this helps.
     
  44. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Same drill .. package over here with instructions .. and .. lets squash that bug!
     
  45. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Got it! I'll try doing it all over again, and if bug reproduced, I'll get back with package
     
  46. Liger

    Liger

    Joined:
    Jul 31, 2012
    Posts:
    2
    Doh. I thought I had removed that after I was done testing it. Thank you for that, sir; works like a charm now.

    Edit:
    Rather than double-posting with another question I figured I'd just propose it here. The OT.Touched bool seems to only process the began touch phase, is there any way to use that bool with the ended phase? Although I've heard bad things about Unity ignoring the .ended phase, so it might just be easier to forgo the OT Touched bool alltogether and make my own phase keeping.

    Thanks a bunch!
     
    Last edited: Aug 1, 2012
  47. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    On you go to your own phase keeping ;)
    for the impact of changing the OT.Touched would be to high.

    however ...

    I will put a bool OT.TouchStarted(OTObject o) ,
    a bool OT.IsTouching(OTObject o) and
    a bool OT.TouchEnded(OTObject o)

    and

    I will put a bool OT.MouseDownStarted(OTObject o, button) ,
    a bool OT.IsMouseDown(OTObject o, button) and
    a bool OT.MouseDownEnded(OTObject o, button)

    and

    I will put a bool OT.DragStarted(OTObject o) ,
    a bool OT.IsDragging(OTObject o, button) and
    a bool OT.DragEnded(OTObject o, button)

    on my TODO list.
     
    Last edited: Aug 1, 2012
  48. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi, Mas, I have a question regarding actions:

    Add("Move", new OTActionMove(new Vector2(0,0),3f,OTEasing.Linear));

    as per tutorial I defined this inside class.

    Not, I run it from code like this:

    owner.Run("Move")

    is there some way to make Vector2(0,0) actually a variable? So I could change movement destination every time I use this action? Or I will have to create new Move action every time for this?
     
  49. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I am sorry to say that there isn't a way to dynamicly set/request the 'from' or 'to' value of a OTTweenAction.

    However .. I can see that this would make things more flexible so ...

    I will put some support for this on my TODO list

    something like (some examples) .. mind you .. the thing you are running could be a single action or an action tree with multiple actions.

    Code (csharp):
    1.  
    2. spriteActions.Run("Move").From(Vector2.zero).To(new Vector2(10,10));
    3. spriteActions.Run("Move").To(new Vector2(10,10)).Speed(2);
    4. spriteActions.Run("MoveTree").Action("Move").From(Vector2.zero).Duration(10);
    5. spriteActions.Run("MoveTree").Action("Move",2).To(Vector2.zero).
    6.      Duration(10).Easing(OTEasing.ElasticOut);  // second move action in tree
    7.  
     
    Last edited: Aug 2, 2012
  50. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! I thought so, but no worries, I'll find a way to workaround it for now :)