Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace tile object by a tscn file using custom property. #3

Closed
erniel opened this issue Mar 18, 2023 · 11 comments
Closed

replace tile object by a tscn file using custom property. #3

erniel opened this issue Mar 18, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@erniel
Copy link

erniel commented Mar 18, 2023

using a custom property "resPath" with String value(path of tscn file). when imported, the tile object will be replaced by the tscn file.

@Kiamo2 Kiamo2 added the enhancement New feature or request label Mar 19, 2023
@Kiamo2
Copy link
Owner

Kiamo2 commented Mar 19, 2023

I suggest a new object class 'instance' (for rectangle, polygon, ellipse, point objects) + this custom property for the res file path.
I don't see any compelling reason why it has to be a tile object (which would normally lead to a Sprite2D).
Do you agree with this proposal?

@erniel
Copy link
Author

erniel commented Mar 20, 2023

i actually like the implementation of tile object into sprite2D. i just find it better to have additional feature for tile object to use for res file path so that tiled and godot will have the same appearance.

image
image.
*screenshot from tiled godot4 exporter.

@erniel
Copy link
Author

erniel commented Mar 20, 2023

additionally if tiled object has detected that it has collision shape and has a class of "static" or "area". it should turn into Area2D with Sprite and CollisionShape or StaticBody2D with sprite2D and CollisionShape when imported. this feature is present in vnen's tiled importer. godot-tiled-importer

@Kiamo2
Copy link
Owner

Kiamo2 commented Mar 20, 2023

Ok, got it.

@erniel
Copy link
Author

erniel commented Mar 20, 2023

ill show a screenshot of what i made previously on godot 3.5.
in here a tile object is detected with collisionshape and a class of "static"
image
at the same time the collision has a class of "one-way"
image
and this how it turns out in godot 3.5
image

also work the same if its class is "area"

@Kiamo2
Copy link
Owner

Kiamo2 commented Mar 20, 2023

Thanks for the clarification, I didn't know that (never dealt with vnen's importer and Godot 3.5).
Very interesting.
I'll implement that but can take a few days.

@Kiamo2
Copy link
Owner

Kiamo2 commented Mar 27, 2023

v1.2: All suggestions discussed here are implemented now.

@erniel
Copy link
Author

erniel commented Mar 28, 2023

wow! thanks a lot for implementing it.

@erniel
Copy link
Author

erniel commented Mar 28, 2023

im not sure if i should bring this up. this might be a user matter. in tiled the origin position is in lower left corner. while in godot, usually the origin is in the center. or depends on how they create the instance.

in my example. the origin of my instance is in the center. when imported. the instance is kinda off. godot x,y position follows the x,y coordinates of tiled which is in lower left corner.

image
image

would it be possible for you to update so that when imported it will match? im thinking of the godot x,y position should take the tiled X + (width/2) and Y - (height/2).
or implement another thing if you have something in mind.

@Kiamo2
Copy link
Owner

Kiamo2 commented Mar 28, 2023

For rectangle objects the Tiled origin is the upper left corner. And that's were the .tscn "naturally" is placed and which works in my test examples. If the origin of your instance is not also the upper left corner but the center this of course does not match.
So the easiest thing might be to change the ladder position in your .tscn.
If this should be not enough for you I'm unsure what's useful without actually having your .tmx/.tsx and .tscn.
Would it then be possible for you to zip those and provide it somehow?

@erniel
Copy link
Author

erniel commented Mar 28, 2023

Its fine, i guess ill just have to edit something on my end. overall the importer works great. Thanks

@erniel erniel closed this as completed Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants