• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows How can I make a character transformation.?

V

Vikn3

Guest
Hey, im kinda new to programming on game maker so i had a question.

How can i make my character in game show a animation and then change to another character. ( On button press )

For example: If you press button m while being mario you transform to super mario.
 

The-any-Key

Member
If you draw mario transform into something else in image sequence. You can set it as sprite_index and when the animation is done (animation end event) change the sprite_index to the new character.
 
V

Vikn3

Guest
Bit better explanation of what im trying to do.









It just doesn't seem to work for me :thinking:

Code:
if (global.player = obj_mario)
{
   
    if (keyboard_check_pressed(special3key) && sprite_index == stance_sprite)
    {
        image_index = 0 ; 
        sprite_index = transform_sprite ; 
       
        global.charCurrent = ++global.charCurrent mod 3
        instance_change(global.charList[global.charCurrent],0)
    }
}


special3key = ord("W") ;



    global.charList[0]=obj_mario
    global.charList[1]=obj_supermario
    global.charList[2]=obj_supermario2
   
   
    global.charCurrent = 0
 

AZAMATIKA

Member
Create the Mario sprite.
Create the Transform animation (8 or 10 frames, for example).
Create the Super Mario sprite.
When press 'W' check the sprite, if sprite_index=s_mario {image_index=0; sprite_index=s_transform; image_speed=1}
In Animation End event check the sprite_index=s_transform, if yes, change the sprite_index=s_super_mario or change the instance.
 
V

Vikn3

Guest
Create the Mario sprite.
Create the Transform animation (8 or 10 frames, for example).
Create the Super Mario sprite.
When press 'W' check the sprite, if sprite_index=s_mario {image_index=0; sprite_index=s_transform; image_speed=1}
In Animation End event check the sprite_index=s_transform, if yes, change the sprite_index=s_super_mario or change the instance.


I tried multiple ways that should work but the character just doesn't change or if it does it only changes till i start moving

My characters are in objects so im trying to switch instances between objects.

But I also have could it be that its not working because i have a character selection with multiple characters?
Im using global.player to know witch one im using but i even tried to use that on "W" pressed it's just not working :thinking:

Code:
if (global.playerpower > 1)
{
    if (landed && sprite_index == stance_sprite && keyboard_check(transformkey))
    {
        global.playerpower -= 1 ;
      
       if (global.player = obj_mario)
       {
           global.player = obj_super_mario ;
       }
    }
}
Sorry if im asking for too much help haha, just new to game maker engine
 
Last edited by a moderator:
Top