Face direction

Potato123

Member
Hi, I'm having problem to my follower facing to specific direction, like it just work when I'm not clicking in any button while warping to move the player, but when I still pressing the key to move the follower start with the sprite icon on obj propreties.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Please post the relevant code. We can't really diagnose a description of a problem on its own... :)
 

Potato123

Member
oh sorry I forgot it
GML:
//create follower
dir = 0;
// Warp Solve
if (global.targetX != -1)
{
  x = global.targetX;
  y = global.targetY;
  dir = global.targetDirection;
}
//step follower
//idle switch directio
switch(dir)
{
//direita
    case 0:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_right
        break;
        
//Superior direita
    case 45:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_up_right;
        break;
        
//cima
    case 90:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_up
        break;
        
//superior esquerda
    case 135:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_up_left
        break;
        
//esquerda
    case 180:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_left
        break;
        
//inferior esquerda
    case 225:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_down_left
        break;
        
//baixo
    case 270:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_down
        break;
        
//inferior direita
    case 315:
        if (keyboard_check(vk_nokey)) && (global.timer <= 0)
        sprite_index = spr_Iara_idle_down_right
        break;
        }
//warp step
if (instance_exists(obj_Marisol)) && (place_meeting(x, y, obj_Marisol)) && (!instance_exists(obj_transition))
   {
    var inst = instance_create( 0, 0, obj_transition);
    inst.targetX = targetX;
    inst.targetY = targetY;
    inst.targetRoom = targetRoom;
    inst.targetDirection = targetDirection;
   }
//game create
global.targetRoom = -1;
global.targetX = -1;
global.targetY = -1;
global.targetDirection = 0;
PS: I am not using the player and the follower persistent
 

Nidoking

Member
Everything here that would set a sprite_index is conditioned on keyboard_check(vk_nokey). So nothing you've posted here has any effect on the sprite if any key at all is down.
 
Top