• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Sprite Layer Alpha Function?

T

Treecase86

Guest
So, I've been working on a Mega Man X engine, and I have the X sprite with layers for each armour piece. My question is there a function to set these layers to be visible? Or do I have to make separate sprites for each piece?
Another problem, I have it so that if you collide with the capsule, the armour is drawn on the object. However, the armour keeps being drawn over and over, and it doesn't even follow him outside of the capsule. How do I fix this?
Many thanks!
 

rIKmAN

Member
So, I've been working on a Mega Man X engine, and I have the X sprite with layers for each armour piece. My question is there a function to set these layers to be visible? Or do I have to make separate sprites for each piece?
Another problem, I have it so that if you collide with the capsule, the armour is drawn on the object. However, the armour keeps being drawn over and over, and it doesn't even follow him outside of the capsule. How do I fix this?
Many thanks!
Not entirely sure what the question is, but you can set the visibility of layers using the layer_set_visible() function.
https://docs2.yoyogames.com/source/...reference/rooms/layers/layer_set_visible.html
 
D

drowned

Guest
You're referring to the layers in the sprite editor, right? Are you saying that when megaman picks up a capsule, his armor changes? You could theoretically set the armor up to follow him around, but then how would you deal with different animations? Jumping, crouching, sliding, firing, etc. I think you're a lot better off drawing an armored sprite and an armorless sprite.
 

rIKmAN

Member
Sadly, no. I'll just do it the hard way, as it seems there is no function for what I want.
Thanks for the help, though!
Ahhhh sprite layers from the sprite editor, that wasn't clear from your post.

Yeah you would have to either draw the different sprites and swap them out, or draw individual pieces and use a controller object to draw the correct pieces based on the state / current animation.
 

CMAllen

Member
Sprite layers only exist in the editor. When you build/preview your game, only the combined asset is sorted onto a texture page.

That being said, you CAN separate each layer into it's own sprite and draw (or not draw) the parts as you see fit. It will be more work keeping all those additional sprite resources straight, but it's definitely doable (from experience).
 
Top