• 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!

Any helpful tutorials for Dress Up Games for GMS2?

Ciez17

Member
I thought I'd take up a quick project to help me break into GMS2 some more. If anyone's familiar with sites like AzaleasDolls or DollDivine, I'm looking for systems like that. Where you click on a certain item and it replaces whatever was on the doll before it, as well as a palette for recoloring different items. I figured it's a VERY easy project and it shouldn't be too hard to do.

Thanks in advance!
 
Easy always depends on your skill level. If you're a complete beginner, this will be a hard project to figure out. As for tutorials, I haven't seen any for this type of game. Perhaps when you figure it out, you should make one =)

As a few tips, when drawing your 'doll', you should probably have a single object draw the basic nude doll sprite (or non-nude if it's starts off with basic clothing) as well as drawing all the clothing. When you are drawing the clothing, as opposed to drawing the clothing sprites like this:
Code:
// Don't do this
draw_sprite(spr_plain_shirt,0,x,y-20);
draw_sprite(spr_fancy_pants,0,x,y);
// Etc
You would use a variable for each clothing section, so something like this:
Code:
// Do this instead
draw_sprite(global.shirt,0,x,y);
draw_sprite(global.pants,0,x,y);
// Etc
At the start of the game, you would assign those variables to default values:
Code:
global.shirt = spr_plain_shirt;
global.pants = spr_fancy_pants;
Then when you click on an item, you would reassign the variable associated with that clothing section:
Code:
// When you click on the Long Trousers clothing piece
global.pants = spr_long_trousers;
The palette swapping is not for beginners. It usually involves a shader, however, you are in luck because PixelatedPope has a palette changing tool: https://marketplace.yoyogames.com/assets/1661/retro-palette-swapper. It costs $3.99, which it is definitely worth, but if you can't afford to put any money into the game, there's a number of palette swapping tutorials on youtube and on the forums I believe. Just have a search around and see if you can muddle your way through.
 

Ciez17

Member
Easy always depends on your skill level. If you're a complete beginner, this will be a hard project to figure out. As for tutorials, I haven't seen any for this type of game. Perhaps when you figure it out, you should make one =)

As a few tips, when drawing your 'doll', you should probably have a single object draw the basic nude doll sprite (or non-nude if it's starts off with basic clothing) as well as drawing all the clothing. When you are drawing the clothing, as opposed to drawing the clothing sprites like this:
Code:
// Don't do this
draw_sprite(spr_plain_shirt,0,x,y-20);
draw_sprite(spr_fancy_pants,0,x,y);
// Etc
You would use a variable for each clothing section, so something like this:
Code:
// Do this instead
draw_sprite(global.shirt,0,x,y);
draw_sprite(global.pants,0,x,y);
// Etc
At the start of the game, you would assign those variables to default values:
Code:
global.shirt = spr_plain_shirt;
global.pants = spr_fancy_pants;
Then when you click on an item, you would reassign the variable associated with that clothing section:
Code:
// When you click on the Long Trousers clothing piece
global.pants = spr_long_trousers;
The palette swapping is not for beginners. It usually involves a shader, however, you are in luck because PixelatedPope has a palette changing tool: https://marketplace.yoyogames.com/assets/1661/retro-palette-swapper. It costs $3.99, which it is definitely worth, but if you can't afford to put any money into the game, there's a number of palette swapping tutorials on youtube and on the forums I believe. Just have a search around and see if you can muddle your way through.
Thanks so much!
But to reiterate, this:
Code:
// When you click on the Long Trousers clothing piece
global.pants = spr_long_trousers;
Is what causes a new selected item to replace another when clicked?
 
Yeah, so basically, under the relevant Mouse Click Event (or however you handle "clicks") you would set the appropriate global variable to a sprite. So, let's use an example. You have your obj_doll object, which is drawing all the sprites using the global variables. To the side, you have a Fancy Pants object, called obj_fancy_pants that will put the Fancy Pants on your doll when you click on it. This is the most stripped down, barebones system for this you could make (in other words, you should be trying to take this concept and expand on it to fit what you need, not necessarily just plug it in as is):

obj_doll Create Event:
Code:
global.hat = spr_hat_basic;
global.shirt = spr_shirt_basic;
global.pants = spr_pants_basic;
global.shoes = spr_shoes_basic;
obj_doll Draw Event:
Code:
// Draw the basic doll
draw_sprite(spr_nude_doll,0,x,y);

// Draw the hat
draw_sprite(global.hat,0,x,y-40);
// Draw the hat
draw_sprite(global.shirt,0,x,y-20);
// Draw the pants
draw_sprite(global.pants,0,x,y);
// Draw the shoes
draw_sprite(global.shoes,0,x,y+20);
obj_fancy_pants Left Released Mouse Event:
Code:
global.pants = spr_pants_long_trousers;
instance_destroy(); // Obviously, only use this line if you want the obj_fancy_pants instance to get destroyed after it's updated the pants on obj_doll
Now, when you click on the obj_fancy_pants object, your obj_doll object will automatically draw the new spr_pants_long_trousers sprite instead of the spr_pants_basic because you've updated the global.pants variable and the Fancy Pants object will be destroyed.
 

Ciez17

Member
Alrighty, I attempted to code the doll create event with the global elements, and I keep getting this:
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object doll:

Variable doll.spr_hat_basic(100002, -2147483648) not set before reading it.
 at gml_Object_doll_Create_0 (line 4) - global.hat = spr_hat_basic;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_doll_Create_0 (line 4)
I did make some incredibly rudimentary sprites with the same name so I have NO idea what's wrong. Like am I supposed to make a separate object for each basic clothing?
 
Last edited:

Ciez17

Member
For reference here's the Create Event under obj_doll:
Code:
/// @description Insert description here
// You can write your code in this editor

global.hat = spr_hat_basic;
global.shirt = spr_shirt_basic;
global.pants = spr_pants_basic;
global.shoes = spr_shoes_basic;
and the actual draw event:
Code:
// Draw the basic doll
draw_sprite(spr_nude_doll,0,x,y);

//Draw the hat
draw_sprite(global.hat,0,x,y-40);

//Draw the shirt
draw_sprite(global.shirt,0,x,y-20);

//Draw the pants
draw_sprite(global.pants,0,x,y);

//Draw the shoes
draw_sprite(global.shoes,0,x,y+20);
And I did place the doll in the room.
 

Ciez17

Member
Clear your asset cache. Check whether you are destroying the sprite at run time and ensure that it is present in your asset tree.
Okay, where do I find that?

OMG I solved it. I didn't add the friggin "spr" I front of my sprites' names. *facepalm*

Behold, the new standard of beauty:
upload_2019-5-1_19-45-49.png

Now for the "left mouse pressed" event. Do I make it under every separate object, or like a single object to link back to? Like, I was about to make one under the fancy_pants object. It seems simple, but I'm not sure where it belongs.
 

TsukaYuriko

☄️
Forum Staff
Moderator
It's entirely up to you and your project structure which constructs are possible, which are feasible and which are optimal. Without knowing how your the involved user interface elements are structured, there's not much we have to go by to provide any form of advice regarding that.

Assuming that you're using said mouse event to change the active sprite of any given component...
Having different objects with their own events each for different clothes is possible, but not feasible and certainly not optimal. Depending on how many pieces of clothing you end up having, that would be an enormous amount of manual work.

You could as well use a single object that handles all clothes, has a single mouse event that updates the equipped clothes, and two variables - one dictates which slot the clothes should go in, the other one contains the sprite that should be assigned to said slot.
If you're placing the clothes selection UI elements into the room manually, you could set these two variables using their instance creation code.
You could then use a switch statement inside the object's mouse event to first check which slot to assign the piece to, then assign it accordingly.
 

Ciez17

Member
You could as well use a single object that handles all clothes, has a single mouse event that updates the equipped clothes, and two variables - one dictates which slot the clothes should go in, the other one contains the sprite that should be assigned to said slot.
If you're placing the clothes selection UI elements into the room manually, you could set these two variables using their instance creation code.
You could then use a switch statement inside the object's mouse event to first check which slot to assign the piece to, then assign it accordingly.
THIS. I saw a video tackling this sort of approach, which a whole lot less time consuming and more practical.

This is the sort of system I'm going for. Where clicking on a certain item replaces the other.
upload_2019-5-1_21-45-2.png

I'm assuming these types of games are using the method above. As they have several pages and I imagine that having one object per room would be much easier to control.
 
Top