Comments (23)
We may use a Signal : when the map is loaded or is already included in the tileSets we dispatch a Signal. And then we process the map.
However we have to be careful if we use multiple external tileSets.
from citrus-engine.
I've working on this, take a look on the last update : 5abd134
With the example updated : https://github.com/alamboley/Citrus-Engine-Examples/blob/master/src/tiledmap/TiledMapGameState.as
If we have several tilesets png and don't want to embed them, we have to load all of them before using something like LoaderMax...
Hope that help!
from citrus-engine.
Ok, I updated my gist slightly https://gist.github.com/9cde603db32d1d58b8b2
I'm not sure is this a best practice, but it works for me at least :)
I had to move TmxMap loading outside the constructor because otherwise it process the level before I can add a listener to it.
Also my FromTiledMap takes now the whole tmx object as parameter this way I can make sure that external files are loaded before I process it.
... and this version of FromTiledMap uses TextureAtlas instead of actual images.
I did not yet update it to use multiple texture files (referring to your last post)
from citrus-engine.
We have two differents approach :) For me, we shouldn't load external tilesets into the TmxMap, but load them before and give them as an argument, like I did. I don't pretend this is the best solution, but loading directly in the TmxMap class we have to be sure to do it in a modular way so users won't have problem: e.g. offering the path as an argument (it might be on mobile, ect...).
Using QuadBatch and TextureAtlas make it greatly optimized for Starling!
However I'm not sure to understand the goal of this line :
(ce as StarlingCitrusEngine).starling.stage.addChild(qb);
Why did you add the qb on the stage? At the same time you provide CitrusSprite with the same qb, you may experiment some overlapping.
When I've designed this exporter, I'd in mind that it should works with flash display list and Starling, so I used Bitmap which is not the most optimized solution. Maybe I should dissociate those version and create a new ObjectMakerStarling class.
I didn't use a lot this editor/exporter so any feedbacks is welcome! We may have a new tutorial made by Lee Brimelow using this Tiled Map Editor, it will provide us informations on what people need.
from citrus-engine.
Yep. Those external tilesets will help me so much as a programmer, because I can make those tileset files separately from the levels and then just give those to level designers. I have gave up on hope to explaining how to add custom variables to tiles :D (Our level designers are not "REAL" level designers)
(ce as StarlingCitrusEngine).starling.stage.addChild(qb);
Just ignore that :D It was something that I tried out when I had problems Feathers overlaying everything.
... but yeh, ObjectMakerStarling sounds awesome aswell.
from citrus-engine.
Hey Ossi, I'm definitely considering your solution with tiled maps using quad batch and creating an ObjectMakerStarling class, optimized!
Would you mind to provide me an example/samples using a TextureAtlas? Thanks again!
from citrus-engine.
Ok, I got it working! However do you also have a "line" between each tile? They come from the background, if you change its color, it'll change the color line.
from citrus-engine.
I've make a new build so it can be tested : http://citrusengine.com/v3-0-4-meets-the-dragon/
from citrus-engine.
I haven't tested it yet but the line thing sounds like the problem that I had earlier.
Check out this thread
http://forum.starling-framework.org/topic/tile-map-issue-with-starling
from citrus-engine.
Thanks a lot, it made the trick! :)
from citrus-engine.
Nice! 👍
from citrus-engine.
I finally had some time to test ObjectMakerStarling. It works perfectly!
Tough, I still had to change FromTiledMap to take the entire tmx object as an argument, because I need to load those external tileset files. I also made TmxMap class to skip the external files as otherwise it creates an "empty" tileset from them.
https://github.com/osro/Citrus-Engine/commit/7302b11d68c792d62e886cb9e7ca78eb016c4a2f
https://gist.github.com/dc8e589fef58bb5cd98b
from citrus-engine.
I've never worked with external tilesets in the editor, and I don't have tsx file to test. Have you find some tsx samples?
However when we parse the map, we should have information on the external tile sets right?
from citrus-engine.
Yep, the main problem is that as the current ObjectMakers will create the TmxMap object and I don't have a way to add those tilesets before it process the objects.
In the Tiled editor you can export any tileset you have made to an external file.
And then you can import that file to other maps from menu (Map > Add External tileset)
The tileset file is XML file that is in the same format as it would be inside the TMX file.
https://github.com/bjorn/tiled/wiki/TMX-Map-Format
Here is an example from one of my files
<?xml version="1.0" encoding="UTF-8"?>
<tileset name="tilset" tilewidth="32" tileheight="32">
<image source="../../../assets/images/tileset.png" width="64" height="128"/>
<tile id="0">
<properties>
<property name="name" value="ground4"/>
</properties>
</tile>
<tile id="1">
<properties>
<property name="name" value="ground3"/>
</properties>
</tile>
<tile id="2">
<properties>
<property name="name" value="ground2"/>
</properties>
</tile>
<tile id="3">
<properties>
<property name="name" value="ground1"/>
</properties>
</tile>
<tile id="4">
<properties>
<property name="name" value="brick1"/>
</properties>
</tile>
</tileset>
from citrus-engine.
Ok, I've be able to test quickly! That's cool, it exports the properties that we defined.
Then if we add our tsx as an external tile, we can't see properties. However using the button on the left import the tilesets and then we can access properties. Finally, it isn't what we need ?
from citrus-engine.
There is some technical limitation once you have exported your tileset.
So if you want to edit the properties again, you need press the import button, make your changes and then export it again to a same file.
from citrus-engine.
Yes indeed, but finally we can do it easily. The problem with ObjectMaker is to make it as generic as possible. And finally if we can use simple tricks to do it, that's perfect!
from citrus-engine.
I mean, finally we just need to press the import button on our external tsx file and then it will be ok via the ObjectMaker. There is a problem using this method?
from citrus-engine.
Nope, the tmx file will point to the external file
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="60" height="40" tilewidth="32" tileheight="32">
<tileset firstgid="1" source="tileset.tsx"/>
<layer name="Tile Layer 1" width="60" height="40">
... etc
from citrus-engine.
I've make some test : indeed you have this "code" if the tileset is external, but then if you import it, it is no more external.
<tileset firstgid="121" source="../../../../../../Desktop/tiles.tsx"/>
<layer name="background" width="20" height="10">
after import :
<tileset firstgid="121" name="tiles" tilewidth="64" tileheight="64">
<image source="Genetica-tiles.png" trans="ff00ff" ...
And it works fine with the actual ObjectMaker
from citrus-engine.
Yep, but then I lose the point why it's external file :D
What I have done is that I have one "template.tmx" file where I manage my external tilesets.
Now this way I can keep the other mapfiles pointing to those external files and I don't have todo the "export/import" part to all of my maps.
from citrus-engine.
Hmm ok, I understand :)
from citrus-engine.
Now that the ObjectMakerStarling enables the AssetManager as an argument, there shouldn't be anymore issues.
from citrus-engine.
Related Issues (20)
- MediatorScene._poolObjects after scene cycle, has null. HOT 2
- Implement a 'remove()' method to PhysicsCollisionCategories.as HOT 1
- ObjectMakerStarling is using old QuadBatch HOT 4
- Feathers swc version problem
- rename _realState to _realScene in display list Scene
- Jump bug CE 3.1.12 + Nape HOT 2
- MathUtils
- ViewportMode.FULLSCREEN -> ViewportMode.SHOW_ALL
- GameInput : update CE's input package
- easy way to activate/deactivate objects
- Accessing undefined properties starling.contentScaleFactor HOT 7
- CitrusSoundGroup could be created like any other CE object, not only creating a custom class HOT 3
- FluidBox.as needs to be removed HOT 1
- SpriteArt/StarlingArt dragonBones code HOT 2
- CitrusStarlingJuggler (pausable juggler) per StarlingScene
- Get rid of linked list in the pooling system
- The classes should implement the functions of interface 'ISpriteView' HOT 1
- Camera onPostUpdate / enabled
- Create NapePhysicsCompound/Box2DPhysicsCompound
- Yay
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from citrus-engine.