1
我只是在團結和遊戲製造者身上工作了兩個月,所以我並不擅長。我有一個小問題。我有一個與主角相撞的平臺,現在可以工作。但是如果我想添加兩個或更多的平臺,遊戲就會陷入困境。我現在使用Game Maker Studio工作。遊戲平臺
//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;
if (place_meeting(x,y+1,obj_platform) || place_meeting(x,y+1,obj_platform1)){
vsp = key_jump * -jumpspeed;
}
//Horizontal collision
if (place_meeting(x+hsp,y,obj_platform) || place_meeting(x+hsp,y,obj_platform1)){
while (!place_meeting(x+sign(hsp),y,obj_platform) || place_meeting(x+sign(hsp),y,obj_platform1)){
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
//Vertical collision
if (place_meeting(x,y+vsp,obj_platform) || place_meeting(x,y+vsp,obj_platform1)){
while (!place_meeting(x,y+sign(vsp),obj_platform) || place_meeting(x,y+sign(vsp),obj_platform1)){
y += sign(vsp);
}
vsp = 0;
}
y += vsp;
//Diagonal collision
if(place_meeting(x+hsp, y+vsp, obj_platform) || place_meeting(x+hsp,y+vsp,obj_platform1)){
while(!place_meeting(x+sign(hsp), y + sign(vsp),obj_platform) || place_meeting(x+sign(hsp), y + sign(vsp),obj_platform1)){
x+= sign(hsp);
y+= sign(vsp);
}
hsp = 0;
vsp = 0;
}
我不認爲我做了錯誤,平臺能像它應該,但如果你跳PLATFORM1,整場比賽stucks。
在此先感謝!