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

Allow multitile sprites to be animated #51257

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

Fris0uman
Copy link
Contributor

Summary

Interface "Allow multitile sprites to be animated"

Purpose of change

Allow multitile sprites to be animated

Describe the solution

Piggy back on #50180 that made multitile accept variants and use those variants for animation

Describe alternatives you've considered

Load animated bool for subsprites too

Testing

Using this json for t_soil

{
  "id": "t_soil",
  "fg": 4169,
  "multitile": true,
  "additional_tiles": [
    { "id": "center", "fg": 4147 },
    {
      "id": "corner",
      "animated": true,
      "fg": [
        { "weight": 2, "sprite": [ 4149, 4152, 4150, 4148 ] },
        { "weight": 1, "sprite": [ 4149, 4153, 4150, 4148 ] },
        { "weight": 1, "sprite": [ 4149, 4152, 4151, 4148 ] }
      ]
    },
    {
      "id": "t_connection",
      "animated": true,
      "fg": [ { "weight": 2, "sprite": [ 4165, 4168, 4166, 4164 ] }, { "weight": 1, "sprite": [ 4165, 4168, 4167, 4164 ] } ]
    },
    {
      "id": "edge",
      "animated": true,
      "fg": [ { "weight": 2, "sprite": [ 4156, 4154 ] }, { "weight": 1, "sprite": [ 4156, 4155 ] } ]
    },
    {
      "id": "end_piece",
      "animated": true,
      "fg": [
        { "weight": 2, "sprite": [ 4159, 4162, 4160, 4157 ] },
        { "weight": 1, "sprite": [ 4159, 4163, 4160, 4157 ] },
        { "weight": 1, "sprite": [ 4159, 4162, 4161, 4157 ] },
        { "weight": 1, "sprite": [ 4159, 4162, 4160, 4158 ] }
      ]
    },
    { "id": "unconnected", "fg": [ 4169, 4169 ] }
  ]
}
2021-08-31.11-31-30.mp4

Additional context

@actual-nh actual-nh added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. SDL: Tiles / Sound Tiles visual interface and sounds. labels Aug 31, 2021
@dseguin
Copy link
Member

dseguin commented Aug 31, 2021

I just tried this out. It's really cool!
2021-08-31 13-04-17

@I-am-Erk
Copy link
Member

I-am-Erk commented Aug 31, 2021

Would it be difficult to add an attribute like:

  "id": "t_soil",
  "fg": 4169,
  "multitile": true,
  "sync_animations": true

Default false, and if false, the animation for each tile would start on a random frame?

EDIT: i just realized how small this PR is. My change could be a follow up feature.

@I-am-Erk I-am-Erk merged commit 36d4022 into CleverRaven:master Aug 31, 2021
@Fris0uman Fris0uman deleted the animated_multitile branch September 1, 2021 06:23
@int-ua
Copy link
Contributor

int-ua commented Sep 6, 2021

Looks like it's not backward-compatible as in tilesets that add these new attributes will be causing errors on stable builds.

@Fris0uman
Copy link
Contributor Author

Ah right, because the animated field is not loaded for subtiles in previous version and unvisited fields cause error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc. SDL: Tiles / Sound Tiles visual interface and sounds.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants