H
Herlander
Guest
I'm fairly new to the community but already loving it. Posted a question and was answered immediately. Here's the question and response:
"hi, I'm kind of new to game maker and need some help.. was hoping you could help me out:
I wanted to know if there is a way to code your main player and have other player objects inherit it in a way that you only have to change the sprites to make a brand new character, given that the mechanics will be the same... Hopefully, you can help me on this"
"What you're looking for is parenting. Here is a link: https://docs.yoyogames.com/source/dadiospice/001_advanced use/more about objects/parents.html "
Now, how I implemented this was, I made the main character without any sprites, all the basic mechanics. Then i created various sprite variables and left them empty (i.e. spr_idle = ""; spr_run = ""; etc.). I declared the variables in the main character (sprite_index = spr_idle; etc..) and made it a parent of other player objects. so now all i have to do in the create event is define the variables (i.e. spr_idle = megaman_idle) to create many characters without having to code them all.
P.s.: I know this is hellah basic, but i made this thread on behalf of all the noobs such as myself lol
"hi, I'm kind of new to game maker and need some help.. was hoping you could help me out:
I wanted to know if there is a way to code your main player and have other player objects inherit it in a way that you only have to change the sprites to make a brand new character, given that the mechanics will be the same... Hopefully, you can help me on this"
"What you're looking for is parenting. Here is a link: https://docs.yoyogames.com/source/dadiospice/001_advanced use/more about objects/parents.html "
Now, how I implemented this was, I made the main character without any sprites, all the basic mechanics. Then i created various sprite variables and left them empty (i.e. spr_idle = ""; spr_run = ""; etc.). I declared the variables in the main character (sprite_index = spr_idle; etc..) and made it a parent of other player objects. so now all i have to do in the create event is define the variables (i.e. spr_idle = megaman_idle) to create many characters without having to code them all.
P.s.: I know this is hellah basic, but i made this thread on behalf of all the noobs such as myself lol