📩 I share more info like this, tips and behind-the-scenes in my newsletter: blobfish.dev
▬▬▬▬▬▬▬▬▬▬▬▬ FOLLOW ME ▬▬▬▬▬▬▬▬▬▬▬▬
📩 Newsletter: blobfish.dev (best way to follow my work)
🐤 Twitter: / blobfishdev
👽 Discord: thomasgervraud...
🐱👤 Steam: store.steampow...
🐱🐉 Itch: thomasgvd.itch...
▬▬▬▬▬▬▬▬▬▬▬▬ MY GAMES ▬▬▬▬▬▬▬▬▬▬▬▬
🎮 Space Gladiators: store.steampow...
🥔 Lost Potato: store.steampow...
In this video I show you how I make my characters equip armors and display them dynamically in my GameMaker Studio 2 game.
First off I have all the different parts of my characters separated into different layers (head, weapon, body, armor) in my drawing app (Krita) for every animation.
Then I export all of those separately and turn them into spritesheets using TexturePacker before importing them into GameMaker Studio 2.
Once we're there, the goal is to organize all of the sprites and tuck them away in a few variables that we'll be able to call when we need to get the right armor to equip.
To do that, we create 2 variables that are initialized at the beginning of the game that'll contain:
1/ All of the character sprites (body, head, weapon, default armor etc.) that we can retrieve with a character ID.
2/ All of the armor sprites that we can retrieve with an armor ID.
Every sprite in these variables is linked to a specific state (which corresponds to the different animations: idle, move, attack etc.).
Once all of those sprites are initialized correctly, all that's left to do is to retrieve the right ones and draw them in our player object.
So we now go into the player object and override the default draw event of GameMaker Studio 2 with our own function called DrawPlayer().
In that function, we retrieve the sprites that correspond to our current state and draw them on top of another in the right order (body first, then armor, then head etc.). This way our modulable character will be rendered to the screen correctly.
But we also want our character to equip armors, so we need to access the variable that contains the armor sprites and replace the default armor if the character has an armor item.
Негізгі бет GameMaker Studio 2 - Equipping Armors Overview
Пікірлер: 14