Hi.
My enemies were made by pictures, but now I want to make them move.
I did, but I forgot the detail that the picture above has the lowest priority, so it ends up being under the enemy.
Is there any code or plugin that modifies the picture priority?
Thanks
MZ - Is there any way to change priority of a picture?
● ARCHIVED · READ-ONLY
-
-
I don't understand what you mean. Are you talking about enemies in the world map or in battle?
-
Map.I don't understand what you mean. Are you talking about enemies in the world map or in battle?
Im using pictures like...
Show picture 1 Slime idle 1
Wait 8 frames
Show picture 1 Slime idle 2
Wait 8 frames
So on... -
Showing picture isn't the intended way to have enemies. You can't move them around as you want.
You can use events and sprite sheets for that purpose. I could demonstrate if you say which maker you use. -
You could modify the z coordinate of the Sprite_Picture instance.
-
How to do that?You could modify the z coordinate of the Sprite_Picture instance.
-
Like this?Is there any code or plugin that modifies the picture priority?
JavaScript:Keep in mind index of the sprite in the array starts with 0 not 1var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 4, newIndex = 5; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
So when starting index 4 is actually picture 5.
So that above code moves picture 5 above picture 6.
JavaScript:This would then reverse the above code if needed.var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 5, newIndex = 4; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
That's what worked for me in my tests..
(I couldn't get results from simply changing '_zIndex' of the sprite) -
Thank you so much, i gonna try todayLike this?
JavaScript:Keep in mind index of the sprite in the array starts with 0 not 1var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 4, newIndex = 5; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
So when starting index 4 is actually picture 5.
So that above code moves picture 5 above picture 6.
JavaScript:This would then reverse the above code if needed.var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 5, newIndex = 4; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
That's what worked for me in my tests..
(I couldn't get results from simply changing '_zIndex' of the sprite) -
No prob. Hope it works as needed for ya. :)Thank you so much, i gonna try today
-
Worked!!!Like this?
JavaScript:Keep in mind index of the sprite in the array starts with 0 not 1var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 4, newIndex = 5; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
So when starting index 4 is actually picture 5.
So that above code moves picture 5 above picture 6.
JavaScript:This would then reverse the above code if needed.var sprites = SceneManager._scene._spriteset._pictureContainer.children; var index = 5, newIndex = 4; var sprite = sprites[index]; sprites.splice(index, 1); sprites.splice(newIndex,0,sprite);
That's what worked for me in my tests..
(I couldn't get results from simply changing '_zIndex' of the sprite)
Worked!!!
Thank you so much man!
You are a hero!! -
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.