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

Pages: [1]
1
Support / Re: Dynamic Asset Loading and code wise manipulation
« on: January 27, 2012, 06:12:41 pm »
Thanks again for the response. I went ahead and tested out your suggestions, and am able to load sprite collections dynamically and associate them with sprites at runtime and programmatically.

One odd quirk I found is that... when I use the code below, I am able to create a sprite, dynamically load the sprite collection, and see it in the game. However, when I click on the game object that i created with the sprite, everything reverts back to a different state (in this case, it turns into the built-in spider sprite collection with the sprite being the body. I assume that when the inspector attempts to view this, that is finds something it doesn't like and somehow reinitailizes the sprite to defaults?

To test this, I loaded the polygon colliders scene in the sample. I selected the "data" prefab in DemoSpriteCollection in the project and saved it into a resources directory file named "bubba".

I then added code in the GameController reload method to do this:

      // works, but selecting the game object reverts its properties to being a spider.
//      GameObject go = new GameObject();
//      tk2dSprite sprite = go.AddComponent<tk2dSprite>();
//      sprite.collection = Resources.Load ("bubba", typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
//      sprite.spriteId = sprite.GetSpriteIdByName("2dtoolkit_logo");   
      
      
      // works, but selecting the game object reverts its properties to being a spider.
      
      GameObject go = new GameObject();
      tk2dSprite sprite = go.AddComponent<tk2dSprite>();
      tk2dSpriteCollectionData collection = Resources.Load ("bubba", typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
      sprite.SwitchCollectionAndSprite(collection, 12);
      sprite.Build();
      sprite.scale = new Vector3(10, 10, 10);

I see the sprite fine in the game view. Clicking the "Game Object" in the hierarchy view will flip it back to spider mode.

Any idea what I'm doing wrong? It'll be important for us to be able to click and view properties on sprites dynamically generated in game, so I'm hoping this is just something I'm not seeing.

Thanks!


 

2
Support / Re: Dynamic Asset Loading and code wise manipulation
« on: January 27, 2012, 12:59:33 am »
Fantastic response, THANKS for the quick reply. I will dive into your example and give it a shot!

3
Support / Dynamic Asset Loading and code wise manipulation
« on: January 26, 2012, 10:41:28 pm »
Hello there. I bought a copy of 2D Toolkit to evaluate for a project that we're going to be working on... it's a multi-player game that will be 2D and involve quite a lot of customization and artistic variances between players characters.

I'm looking at the toolkit, and I like the editors and I like the simplicity and power, and the efficiency on mobile platforms for draw calls (batching is good. :) ).

One thing that's going to be a critical make or break for us is being able to dynamically load content (sprites, animations, etc...) as players enter and leave various areas of the game (its an MMO style game). Because of the crafting, customization of character look and feel is going to be a high priority. To that end, we'll need to be able to swap out art pieces on animated sprites, weapons will be swapped out on charactesr in the game, etc.

It's infeasible to load all the possible permutations of these combinations ahead of time into one scene (for that matter, the scenes themselves will need to be dynamically loaded via asset bundles and downloaded and instantiated. Also, the various monsters and such will need to be such that we can programmatically instantiate them (not have them hard coded in the scene). In fact, very little will be hard coded into the scene.

I know that the emphasis of the toolkit is heavily on easy editing, and a lot of it gears towards having your assets in the scene. My question is... has someone been able to achieve what we're asking with 2D toolkit in a manner that's flexible, maintainable, and efficient? Or if not, does the developer(s) have some insight on to how this may work. If it's really trying to fit a square peg in a round hole, we're not shy about going with a different solution (and we can always consider the toolkit for a different game in the future, since we bought it already). But in evaluating this great toolkit, I definitely want to know how easy it is to dynamically create sprites and programmatically manipulate them at runtime based on user settings...

Thanks!!

Tim

Pages: [1]