GML Character button operation

uni00

Member
Good evening. I'm Japanese so I use Google Translate.
For some reason, you have to change the character from keyboard operation to on-screen button operation. I used the keyboard to move and change the sprite, but I have to display the move button on the screen to make it for the sootphone.
I converted the if statement that was in the step statement to the with statement and put it in the button, but the sprite did not change, there were many restrictions and it was strict.
So I thought that while the right button is being pressed using the global variable, it should be set to true and put in the argument of the if statement, but increase the five global variables by combining the up, down, left and right buttons and the button that picks up the item. I am worried that may have a bad effect on memory.
How can I convert the right move item in this step statement into a button operation?

GML:
--step(o_player1)--

//rightmove↓
if(keyboard_check(vk_right))
{
    if(place_meeting(x,y,o_spider_floor)){
    hspeed=1/2;
    }
    else{
  hspeed =1;
    }
  sprite_index = spr_player1_walk;
  image_xscale = 1.5;
  if(!audio_is_playing(sound0))
{
audio_play_sound(sound0,1,false);
}
  with(o_lamp_spr){
  sprite_index=spr_lamp;
                  }
}//rightmove↑
else if(keyboard_check(vk_left))
{
      if(place_meeting(x,y,o_spider_floor)){
    hspeed=-1/2;
    }
    else{
  hspeed =-1;
    }
   sprite_index = spr_player1_walk;
   image_xscale =-1.5;
     if(!audio_is_playing(sound0))
{
audio_play_sound(sound0,1,false);
}

     with(o_lamp_spr){
  sprite_index=spr_lamp;
                     }
}
else {
    sprite_index = spr_player1;
    hspeed=0;

      with(o_lamp_spr){
  sprite_index=spr_lamp;
                      }
     }

if(image_xscale=1.5&&vspeed=3){
with(o_lamp_spr){
x=o_player1.x+27;
y=o_player1.y+17;
}
}
else if(image_xscale=-1.5&&vspeed=3){
with(o_lamp_spr){
x=o_player1.x-27;
y=o_player1.y+17;
}
}

audio_listener_position(x, y, 0);
GML:
--step(o_right)--

var cx = camera_get_view_x(view_camera[0]);
var cy = camera_get_view_y(view_camera[0]);


x= cx+55;
y=cy+197;
 
Top