Giter VIP home page Giter VIP logo

Comments (8)

zicklag avatar zicklag commented on June 13, 2024 3

If we're good choosing them randomly for now, it seems like making the image an array is a good idea.

from punchy.

odecay avatar odecay commented on June 13, 2024 1

I feel like we should introduce some concept of variants for spritesheets when its the same enemy "type" rather than giving them all unique definitions. Although maybe in the future the different variants will have different gameplay implications, but we can get to that if it comes up.

from punchy.

zicklag avatar zicklag commented on June 13, 2024

Just a note for anybody finding this issue: now all of the player/enemy types are implemented with YAML, a simple text format, for example the bandit. So this issue is now very approachable for non-programmers! :)

from punchy.

edgarssilva avatar edgarssilva commented on June 13, 2024

Does the current yaml system support nested folders inside the fighters? Since we have multiple variants of the same "type" I was thinking we could have something like:

fighters

  • jerk
    • jerk1
    • jerk2
    • jerk3
  • bandit
    • bandit1
    • bandit2
    • bandit3

Another alternative is to have multiple sprite sheets for each fighter in the yaml and choose one randomly.

from punchy.

edgarssilva avatar edgarssilva commented on June 13, 2024

Could I just turn the image proprety into an array and just randomly select one image path?

from punchy.

edgarssilva avatar edgarssilva commented on June 13, 2024

I'm having a bit of a problem with choosing a random texture.

From my understanding the files are loaded and stored in metadata structs, then these structs are filled to marker entities that will spawn the actual entity (Add missing components).

The problem that I'm having is that even though I load different textures they return the same handle, I'm assuming this is because it thinks that has already loaded that texture.

Not sure if that is because of the label or other causes.

for image in &meta.spritesheet.image {
                let (texture_path, texture_handle) =
                    get_relative_asset(load_context, load_context.path(), image);

                println!("{:?}", texture_path);

                let atlas_handle = load_context.set_labeled_asset(
                    "atlas",
                    LoadedAsset::new(TextureAtlas::from_grid(
                        texture_handle,
                        meta.spritesheet.tile_size.as_vec2(),
                        meta.spritesheet.columns,
                        meta.spritesheet.rows,
                    ))
                    .with_dependency(texture_path),
                );

                println!("{:?}", atlas_handle);
                meta.spritesheet.atlas_handle.push(atlas_handle);
            }

That prints out the following:

AssetPath { path: "fighters/fishy\\PlayerFishy(96x80).png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(6978943932354199104), LabelId(8302211218699850881))))
AssetPath { path: "fighters/sharky\\PlayerSharky(96x80).png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(14630453536192032707), LabelId(8302211218699850881))))
AssetPath { path: "fighters/slinger\\Slinger_Skin1.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(2437720787748651759), LabelId(8302211218699850881))))
AssetPath { path: "fighters/slinger\\Slinger_Skin2.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(2437720787748651759), LabelId(8302211218699850881))))
AssetPath { path: "fighters/slinger\\Slinger_Skin3.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(2437720787748651759), LabelId(8302211218699850881))))
AssetPath { path: "fighters/bandit\\Bandit_Skin1.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(15664738912578234533), LabelId(8302211218699850881))))
AssetPath { path: "fighters/bandit\\Bandit_Skin2.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(15664738912578234533), LabelId(8302211218699850881))))
AssetPath { path: "fighters/bandit\\Bandit_Skin3.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(15664738912578234533), LabelId(8302211218699850881))))
AssetPath { path: "fighters/brute\\Brute_Skin1.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(9822384095410878402), LabelId(8302211218699850881))))
AssetPath { path: "fighters/brute\\Brute_Skin2.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(9822384095410878402), LabelId(8302211218699850881))))
AssetPath { path: "fighters/brute\\Brute_Skin3.png", label: None }
StrongHandle<TextureAtlas>(AssetPathId(AssetPathId(SourcePathId(9822384095410878402), LabelId(8302211218699850881))))

Hope I'm not being a total noob right now 😟

from punchy.

zicklag avatar zicklag commented on June 13, 2024

That is a little strange. Maybe try adding loop index to the label and see if that resolves the issue. So the label would end up being atlas0, atlas1, and so on.

from punchy.

edgarssilva avatar edgarssilva commented on June 13, 2024

That is a little strange. Maybe try adding loop index to the label and see if that resolves the issue. So the label would end up being atlas0, atlas1, and so on.

Still no luck :/

from punchy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.