| Crates.io | hana_prefab |
| lib.rs | hana_prefab |
| version | 0.1.1 |
| created_at | 2024-03-26 09:15:29.290541+00 |
| updated_at | 2024-03-26 09:15:29.290541+00 |
| description | Hana prefab is a plugin for bevy that allows you to store level and other data in rooms using prefabs created in code. |
| homepage | |
| repository | https://github.com/HaNaK0/hana_prefab |
| max_upload_size | |
| id | 1186111 |
| size | 127,408 |
A plugin for storing data
Hana prefab is a plugin for bevy that allows you to store level and other data in rooms using prefabs created in code. This plugin was created because I did not get the built in scenes in bey to work and they were in an incomplete state.
A prefab is predefined game object or resource that can be loaded from a ron file. The way this is done by an interface from the varibles declared in the ron file and compnents and entities in game.
A room is a collection of prefabs and resources declared in a ron file.
(
prefabs: {
"player" : (
type: "Player",
fields: {
"sprite" : String("sprites/bevy-icon.png"),
"position" : String("(0, 0)"),
"speed" : Number(300.0),
"alive" : Bool(true),
}
),
"pig_parent" : (
type: "PigParent",
fields: { },
)
}
)
The room file is made of a root object with a filed called prefabs which is a map type. The prefabs map contains prefab objects which has two fields, type and fields. Type declares which prefab type the object is and fileds contains the fields of the prefab.
The fields are of a enum type with the following variants
pub enum PrefabField {
Vec2(f32)
Number(f32),
Bool(bool),
String(String),
}