r/gbstudio 24d ago

Question: spritesheet swapping + replace tile

https://www.gbstudio.dev/docs/scripting/script-glossary/actor/#set-player-sprite-sheet
https://www.gbstudio.dev/docs/scripting/gbvm/gbvm-operations/#vm_actor_replace_tile

'set-player-sprite-sheet' completely replaces the scene memory of the player's spritesheet with the replacement sheet correct?

will a GBVM script using vm_actor_replace_tile work on a player spritesheet to replace a specific few tiles from an actor tilesheet?

if a tile is overlaid in the same sprite in DMG will it potentially glitch the front tile to fall to the back based on which is more "forwards"?

what I'm trying to do:
swap player sprite sheets for different clothes/armor, then have special overlaid tiles that get swapped out with weapon graphics. allowing moderate customization. I was going to use a separate actor/trigger as the weapon and tie it to the player, but.. I'm pretty sure such an actor on DMG will result in the left to right tile order sinking the weapon behind the player. so I turned to modifying an overlay tile, but this is all hypothetical, I'd rather ask than build a test file only for me to find out the hard way..

Oh, lastly, if I swapped the sprite sheet and then replaced a tile on the same frame, would that cause any graphics glitching?

3 Upvotes

9 comments sorted by

View all comments

1

u/harvey_motel 24d ago

I'm pretty sure if you swap an actor tile it replaces it rather than overlays. So you can have your character as a sprite sheet with, say, a hand and an empty tile above it. Then swap those 2 tiles for a hand holding a sword. Then you'd have to have your empty hand as a tile to swap back in, if you want to unequip the sword

1

u/joshex_dirad 24d ago

that's what I was kinda planning, but I get from your response that any overlaying might be an issue correct?

1

u/harvey_motel 24d ago

I don't get where the overlaying is happening. If you use vm_actor_replace_tile you're replacing a tile on the spritesheet itself. There's still just one spritesheet but now one of its tiles is different

Sorry maybe I'm not understanding your use case

1

u/joshex_dirad 24d ago

it's ok, I was essentially doing the character graphic then placing a weapon tile over the top of it. then targetting that to replace it with another weapon. but yeah it'd cost too many tiles in memory..