GML How to make a transformation sequence? (Transform character into another)

LuisSLS

Member
I want to transform the player character sprite (and object) to another one, like a character transformation sequence. But i dont find any tutorials related, can somebody help me please?

Lets say i have a character, and if i press, for example: "Q", the character transformation animation start and then he turns into his other form.

Edit: Yeah, using the word "Henshin" is a bit confusing and redundant, sorry for that one!
 
Last edited:

kburkhart84

Firehammer Games
There are two parts to this...the graphics...and the code. I don't know which part is the issue you are having.

Graphics....You will need to graphically show the transition I'm assuming(unless you want an instant thing that just looks ugly). That means you need to either draw(or create) sprite frames for it, or create some kind of animation, like something that scales, or fades in/out, or whatever. I don't know what you are wanting to do there, so you will need to be more specific.

Code...this part could be simple, depending on multiple things. I don't know how you are doing things right now. Does the transformed version just use different sprites but act the same except for that? Does it actually have different movement, etc... The coding in either case is likely going to involve using two different objects, but how much code you can re-use between them is going to be based on what you are doing. If they are literally the exact same thing except the graphics, then you could actually keep the same object. You would want to have an array of sprites that says what is the current sprite for each thing, idle, jump, run, walk, whatever your guy does. Then when you transform, change that array's values to the sprites for the transformed version. Then in your code that handles changing sprites for running, etc... you use the sprites stored in the array, and that code won't care which form you are in since it just accesses the array and uses those sprites. However, if the behavior is actually different, then I recommend either using two different objects, or have a couple scripts that you can call from the same object, using a variable to know which scripts to call. There are multiple ways to go about that.
 

Roldy

Member
This question is probably a bit too broad. I would suggest you make an attempt at the effect you want and then when you run into programming problems ask specific questions.

FYI,'henshin' essentially means 'transformation' you don't need to say it twice. Additionally in a show like Kamen Rider they each transform in unique and individual ways. Saying 'like a henshin transformation,' doesn't provide much information on what you want. So choose or plan a specific transformation effect that you want and then try to implement it.
 

LuisSLS

Member
There are two parts to this...the graphics...and the code. I don't know which part is the issue you are having.

Graphics....You will need to graphically show the transition I'm assuming(unless you want an instant thing that just looks ugly). That means you need to either draw(or create) sprite frames for it, or create some kind of animation, like something that scales, or fades in/out, or whatever. I don't know what you are wanting to do there, so you will need to be more specific.

Code...this part could be simple, depending on multiple things. I don't know how you are doing things right now. Does the transformed version just use different sprites but act the same except for that? Does it actually have different movement, etc... The coding in either case is likely going to involve using two different objects, but how much code you can re-use between them is going to be based on what you are doing. If they are literally the exact same thing except the graphics, then you could actually keep the same object. You would want to have an array of sprites that says what is the current sprite for each thing, idle, jump, run, walk, whatever your guy does. Then when you transform, change that array's values to the sprites for the transformed version. Then in your code that handles changing sprites for running, etc... you use the sprites stored in the array, and that code won't care which form you are in since it just accesses the array and uses those sprites. However, if the behavior is actually different, then I recommend either using two different objects, or have a couple scripts that you can call from the same object, using a variable to know which scripts to call. There are multiple ways to go about that.
Thanks guys, i will give it a try! :D . About "Does the transformed version just use different sprites but act the same except for that? Does it actually have different movement, etc...", the character transformed do have a different moveset from his base-form along with new tricks with it. I will try the tip and post progress ASAIC (As soon as i can).
 

TheouAegis

Member
The transformation itself is usually just a sprite animation. If he has different movements, you should use instance_change() at the end of the animation. The fancier the transformation animation, the more code you'll need and, well, that's on you.


 

kburkhart84

Firehammer Games
Thanks guys, i will give it a try! :D . About "Does the transformed version just use different sprites but act the same except for that? Does it actually have different movement, etc...", the character transformed do have a different moveset from his base-form along with new tricks with it. I will try the tip and post progress ASAIC (As soon as i can).
Then I recommend as part of the part where you animate the transformation, you also switch to a different object. Your player object shouldn't be controlling your status stuff, like lives and health, anyway. Those should be stored on a controller type of object, or in global variables if you prefer. So it should be easy to do some simple object swapping. Press 'Q', delete the player, and create the "transforming" object, which would be the one that shows the sprite animation from old to new, does the special effects if you have them, whatever. Then when that is done, it removes itself and adds an instance of the transformed version of the player. It is good to keep things seperate like this. Also, if that transformation takes time, you don't have the player object around in the mean time while its happening, so you don't have to worry about disabling input, etc... because the "transformation" object is just visuals and isn't going to try to jump when you press the jump button.
 
Top