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.


Topics - 1337Rooster

Pages: [1]
1
Support / Can you have clipping on a slided sprite?
« on: September 17, 2013, 05:29:24 am »
I would like to have clipping on a slided sprite.

Basically I want to implement a bar that fills up in my hud, as a gauge. Suppose the gauge fills vertically, and the top and bottom regions are rounded. An easy way to do this would be to

1. Display a slided sprite for the background of the gauge.
2. Display a slided sprite for the foreground of the gauge and modify its clip as the gauge grows and shrinks.

The fact that the clipping and slided sprites are separate types of sprites that don't seem like they can be used together seems like a bit of a limitation in the current API. It feels like they should be features you could apply to sprites, and it would be more powerful if you could use them both together.

2
Support / NullPointerException when using the tilemap editor?
« on: September 04, 2013, 04:57:52 am »
I followed the guide here for version 2.10.
http://www.unikronsoftware.com/2dtoolkit/docs/2.10/tilemap/tutorial.html

The only things I did different, was using my own sprite collection and using a pixels per meter of 1 for my camera and sprite collection.

I get two different errors in the console and the painter doesn't work.

NullReferenceException: Object reference not set to an instance of an object
tk2dTileMapEditorBrush.ClipTiles (Int32 xMin, Int32 yMin, Int32 xMax, Int32 yMax) (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditorData.cs:159)
tk2dTileMapSceneGUI.UpdateWorkingBrush () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:990)
tk2dTileMapSceneGUI.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:616)
tk2dTileMapEditor.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1164)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:1346)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:850)
UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:739)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)





and

NullReferenceException: Object reference not set to an instance of an object
tk2dTileMapSceneGUI.SplatWorkingBrush () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:319)
tk2dTileMapSceneGUI.RectangleDragEnd () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:351)
tk2dTileMapSceneGUI.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:636)
tk2dTileMapEditor.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1164)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:1346)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:850)
UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:739)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

3
Support / Can you use the tilemap without rendering the tiles?
« on: September 03, 2013, 06:46:56 am »
Levels in my game would involve stringing multiple tilemaps together (At certain points I load up the next tilemap in the level by spawning in a bunch of objects when the player completes an objective). You could say that levels are a series of segments, each containing a tilemap, an objective and perhaps other options. So what I really want is a visual way to define a tilemap for a segment, but provide that as data to my game (Rather than just loading that as a full scene). Then have my code be able to take that data and do what it wants with them (I.e. when I place them in the grid I want my GirdManager object to know about them). So the thing I want to gain from the tile map is basically a nice visualization to setup grids, which are parts of  the levels. Each time I load a new tilemap up, there may be a new objective for the player, I would like to define a few properties for this as well.

Levels would consist of:
- A series of options (Maybe I'll have some extra XML/JSON configuration in which will define these options and point to a tilemap).
- multiple tilemaps


An alternative approach I am looking at is using Tiled. As this exports JSON/XML for the levels and I can load this up and manually instantiate prefabs from this. But I need a lot of code to map the JSON to my prefabs.

I've noticed that the tk2d tile map will create a game object with a bunch of prefabs at the painted locations. And the tk2dTileMap  API here doesn't seem to let you iterate over the tiles in the map. It seems like it just instantiated a game object, which contains all of the 
http://www.unikronsoftware.com/2dtoolkit/docs/2.10/html/classtk2d_tile_map.html

So maybe the way to do this with the t2kd editor would be to define a tilemap for each segment of my level, and generate the TileMap Render Data (GameObject hierarchy), store that in a prefab and instantiate one of those when I want to load them. Then iterate across the GameObjects hierarchy and do whatever extra work I need? I'm wondering what the best practice is here? This is essentially the only way to get at this data, correct? Take the prefab the tilemap generated and store that.

Another question, does the TileMap GameObject still need to be around? Or just the TileMap Render Data GameObject hierarchy it creates when you hit commit?

4
Hello,

I'm trying to figure out exactly where this fits into unity and 2d toolkit.

Suppose you want to be able to add effects to sprites, separte from animation. I.e. for every movement animation you have for your character, you might also want to be able to make the sprite flash a certain color. This would be useful to indicate the player has recently taken damage, as done in games like sonic, mario, zelda, etc.

The only way I can think to do this right now is to create an animation for every movement, and also have one for each effect, leading to a combinatorial explosion.

Is there somewhere I can find a list of effects I could apply to animations (Or rather the right APIs to create them?), and if they are part of 2d toolkit or the core Unity? I'm just not sure where the right APIs are for this sort of thing as they don't seem to be covered in the main docs.

5
Support / Multiple sprite colors in practice
« on: August 10, 2013, 07:34:59 pm »

I like the idea of being able to change the colors on a sprite.


Approach #1
1. Create one version of your sprites
2. Use scripts to change color.

Problem with this approach. As far as I can tell the way to change the sprite color applies a blending algorithm with the new color. The guy in this example gets some decent results, but its not quite perfect he doesn't really look like the reference image, and his whites are blending by a lot. Maybe there are a few options here to tweak but I'm not sure if you get the control you want very easily?
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1924.msg9505.html#msg9505
This approach is nice because you can make the sprite animations once.

Approach #2
1. Create a different sprite for each color (Either doing this manually in photoshop or some sort of external script of your own modifying your sprite sheets (I imagine a replace sprite color/flood fill thing might not be to hard to write a python script for).
2. Create a separate sprite collection and animations for each other.

The problem with this seems to be that you need to create new sprite collections and animations multiple times (maybe a lot depending on how many colors you use). But you get a bit better control over how the sprites will look.

I like option 2, but I wonder if there is a workflow to make adding the different color sprites a bit easier? Maybe if I make the animations once, copy them and just toggle the sprite collection this would work? If I keep separate sprite collections for each color and keep sprites with the same names?

I'm just wondering what has worked well in practice for other users?


Edit:
Approach #3
Maybe there is a plugin to change the way colors get modified and I could create an in game way to write my own find and replace colors on tk2d sprites. Does something like this exist?

Pages: [1]