- Joined
- Jul 10, 2016
- Messages
- 114
- Reaction score
- 337
- First Language
- French
- Primarily Uses
- RMVXA
Hi! I'm looking to do pretty much what the title says on RPG Maker VX Ace.
I have a big sprite, much larger than 32x32, and I had a problem with it being anchored wrong, which didn't look good at all.
Thanks to this previous post, I learned that I could fiddle with the
In order to retrieve the sprite and center it correctly, I'm using this script snippet:
The issue is, due to the sprite not being there on map load (the event in question is activated later), that I have no way to predict which index the sprite will have in the character spriteset. In other words, I don't know what SPRITE_INDEX should be.
I guess I could bruteforce all sprites indices until I find the right one, but I'm not so sure that it'll remain the same at all times, and that solution seems shaky to me. If I add another event on the map, it could offset the correct sprite's index in the spriteset and I'd have to guess again!
So I'm wondering if there could be a better way to find the sprite I'm looking for.
Let's say that I know the event's ID whose sprite I want to edit. Are there any script calls that would allow me to reach the Sprite object from the Event so I can change the
Any help much appreciated!
I have a big sprite, much larger than 32x32, and I had a problem with it being anchored wrong, which didn't look good at all.
Thanks to this previous post, I learned that I could fiddle with the
.oy
value of the Sprite object in order to anchor it properly, but I'm having an issue with selecting the correct sprite index.In order to retrieve the sprite and center it correctly, I'm using this script snippet:
Code:
spriteset_map = SceneManager.scene.instance_variable_get(:@spriteset)
sprites = spriteset_map.instance_variable_get(:@character_sprites)
spider_sprite = sprites[SPRITE_INDEX]
spider_sprite.oy -= 26
The issue is, due to the sprite not being there on map load (the event in question is activated later), that I have no way to predict which index the sprite will have in the character spriteset. In other words, I don't know what SPRITE_INDEX should be.
I guess I could bruteforce all sprites indices until I find the right one, but I'm not so sure that it'll remain the same at all times, and that solution seems shaky to me. If I add another event on the map, it could offset the correct sprite's index in the spriteset and I'd have to guess again!
So I'm wondering if there could be a better way to find the sprite I'm looking for.
Let's say that I know the event's ID whose sprite I want to edit. Are there any script calls that would allow me to reach the Sprite object from the Event so I can change the
.oy
value?Any help much appreciated!