TeamREPENTOGON / REPENTOGON

Script extender for The Binding of Isaac: Repentance
https://repentogon.com/
GNU General Public License v2.0
136 stars 15 forks source link

Rendering multiple animations with one Sprite object? #410

Closed Sanio46 closed 5 months ago

Sanio46 commented 5 months ago

This is something not terribly knowledgeable about but only have observed in-game so bare with me here. I've seen examples of sprites we've been given access to thanks to RGON such as the character select menu, nightmare scene, and minimal icons, all have the ability to be one Sprite object but render multitude of animations. The only way to achieve something like this ourselves is an abomination of stacking a ton of layers on one animation and using Sprite:Render layer to render them all separately.

Minimap Icons anm2. It has a ton of different animations, one for each icon image-46

Gross anm2 I had to create to somewhat replicate this. I use Sprite:RenderLayer to render each icon and change frames on that layer, since I only need one on each layer active at a time. image-40

This would be a great feature to have, assuming I'm guessing how this functions correctly.

jsgnextortex commented 5 months ago

I dont get what feature are you requesting here tbh...

ConnorForan commented 5 months ago

I believe the assumption is that the game had some utility for rendering multiple animations from an ANM2 simultaneously, but given how the ANM2/Sprite class works, I'm pretty sure the game is just changing the animation repeatedly

A glance at MiniMap::render_icons() in ghidra seems to support this, it has a loop where it calls SetAnimation/SetFrame/Render etc

Sanio46 commented 5 months ago

In my head with complete assumption without testing it out, I thought changing animations on the same sprite object would affect all current renders of the sprite at the same time, even though that's not how it works. Just something that stuck in my head and I was curious how the game does it. I have a tendency to have an obsession to replicate my own code as closely as to how the game functions as possible. I appreciate the reassurance though and I'll just be changing animations as I render my sprites.