They are automatically trimmed from the excessive border. When you import it into the generator, you will see them layered in a grid, automatically adjusted to optimal number of columns: They also have a transparent border that can be cropped. Let's say you have a couple of images like these: A stand-alone version can be found in Releases tab on this repository. It's a single-scene plugin that you can add to your Godot project. It also allows to configure number of columns, margin between frames and has a cropping capability which keeps relative offset between frames. I wanted to mention it, just in case that helps you.A spritesheet generator that takes a list of images and joins them into a single sheet. That lets you edit the instances directly. By the way, AnimatedTexture can serve a similar role, but it does not give you a way to specify the frame you want.Īnd yes, you could control any of these form a tool script.Īddendum: by the way, you know you can enable "Editable Children" on the scene instances on the Scene panel, right? It is in the context menu. This approach will also work for anywhere you might need a texture, although tweaking the region is more work that simply setting a number. I suggest setting the size (width and height of the region) first. On the texture of your Sprite (for example), select "New AtlasTexture", then atlas of the AtlasTexture load your sprite sheet, and set region to take the area of the texture atlas you want. This gets close to what you want in that you just change a number (the frame).įor completeness I'll also mention that you can use an AtlasTexture to load a texture form an sprite sheet. Instead put all the textures in a single animation, and then change the frame to pick the texture you want. If you have all the textures you want in single atlas/sprite sheet, you can use an AnimatedSprite, except you are not going to use it to animate. This solves the problem of placing an instance of a particular variation of your scene, and being able to tell it apart in the editor, without the need to run your script on the editor. You can change properties such as the texture of sprites, or you can add other scene instances as children. You can make inherited scenes (from the context menu of an existing scene in the FileSystem panel choose "New Inherited Scene"), and there modify it however you want. You should not need _process, which would be running every frame. You can use Engine.editor_hint to identify when your script is running in the editor.īy the way, combine it with setget, so you can define a setter function that will run when you modify the variable. Ryu's approach of using a tool script would work. Set_my_texture() #quick n dirty way for fast reload # only rotate the object if we set the character number to 1 Print("executing custom in editor logic") a more ergonomic (but takes more processing) solution is to put it in the _process func tool In your case, you might use something like the following: (make sure to do "Scene -> Reload saved scene" to reload the constructor if your change the node's property). In your script your want to make it a 'tool' so it can execute inside your editor, and not only when you launch the game. One idea is multiple children scenes, but I cant work out how to turn sprites on or off depending on a variable or some other type of setting. Var player2 = preload("res://Player/es")Īlternatively, I could have multiple sprites in a generic player scene, and turn them on and off depending on the characterNumber, but again, the same problem occurs, the change isn't visible until runtime. Changing the character number makes the image change at runtime: export var characterNumber = 1 This code in the player script is good at allowing setting a player number, and loading a different image set, but it doesn't show in the 2D editor. Whats the best way to make each player appear different in the editor? controls which image/texture/sprite data is loaded, to control the appearance.īut when I drop them on the 2D editor, they all have the default image, so they all look identical. I have a "Player" scene, which holds everything about a player, the sprite, the animations, the shadow, and a collection of other things.Ī script variable 1,2,3,4, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |