2016-12-21 9 views
-2

나는 내 코드를 작동시킬 수 없다. 나는 튜토리얼을 자세히 읽은 후 내 작업을 읽었다. 그것은 교사를 위해 일했지만 내가 그것을 시도했을 때 내 플레이어가 붙어 있었고, 움직이거나 움직이지 않았습니다. 튜토리얼에있는 코드를 다른 부분으로 나눕니다. 여기 게임 제작사 스튜디오 : 나는 내 플레이어의 컨트롤을 깨뜨렸다.

메인 비트입니다 :

///script_get_input 
right_key = keyboard_check(vk_right); 
up_key = keyboard_check(vk_up); 
left_key = keyboard_check(vk_left) 
down_key = keyboard_check(vk_down) 
dash_key = keyboard_check_pressed(ord('C')); 
attack_key = keyboard_check(ord('X')); 

///check for gamepad input 
if (gamepad_is_connected(0)) { 
    right_key = (gamepad_axis_value(0, gp_axislh)>= .5); 
    left_key = (gamepad_axis_value(0, gp_axislh)>= -.5); 
    up_key = (gamepad_axis_value(0, gp_axislv)>= -.5); 
    down_key = (gamepad_axis_value(0, gp_axislv)>= .5) 

} 

이 그들이 무엇을 설정하면서 그 컨트롤을 설정합니다

///scr_move_state 
scr_get_input(); 

///get the axis 
var xaxis = (right_key - left_key); 
var yaxis = (down_key - up_key); 

///get direction 
dir = point_direction(0, 0, xaxis, yaxis); 

///get length 
if (xaxis == 0 and yaxis = 0) { 
    len = 0; 
} else { 
    len = spd; 
} 
///get the hspd and vspd 
hspd = lengthdir_x(len, dir); 
vspd = lengthdir_y(len, dir); 

///move 
phy_position_x += hspd; 
phy_position_y += vspd; 

///control the sprite 
image_speed = sign(len)*.2; 
if (len == 0) image_index = 0; 

///vertical sprites 
if (vspd > 0) { 
    sprite_index = spr_player_down; 
} else if (vspd < 0) { 
    sprite_index = spr_player_up; 
} 

///horizontal sprites 
if (hspd > 0) { 
    spr_index = spr_player_right; 
} else if (hspd < 0) { 
    sprite_index = spr_player_left; 
} 

오 또한 플레이어는 코드

///moves the player in the step event 
scr_get_input(); 
script_execute(state); 
와 상호 작용하는 방법

정말 복잡해 보이고 코딩 언어 초보자입니다. 나는 또한 게임 제작자가 독특한 언어를 사용하여 더 어려워한다고 들었습니다. 모든 의견을 환영합니다!

답변

0

이상한 자습서입니다. 그것을 공유하는 신경?

먼저 phy_position_* 개의 변수를 사용하고 있습니다.이 경우 객체가 물리 변수가되어야합니다. 객체가 물리 객체입니까? 귀하의 방에서 physiscs 세계가 초기화됩니까?

일반적으로 코드는 정상적으로 보입니다. 모두; script_execute(state); 이상하게 보입니다. state라는 스크립트가 있습니까? 그렇다면 그 내용은 무엇이며 왜 state()처럼 실행하지 않는가?