自从我开始使用 GameMaker 以来,我一直在处理这个问题。我已经学习了一个月,期间出现了很多次代码完全正确的情况——经过彻底检查,每个分号都正确位置——但它没有报错,却仍然不能按预期工作。这不是逻辑错误;代码在其他人的电脑上能运行,但在我的电脑上不行。
初始化:
veloc = 2;
direc = 0;
vida = 10;
alfa_add = 0;
步骤: if keyboard_check(vk_up){
sprite_index= spr_nave_andando;
speed = veloc;
}else if keyboard_check(vk_down){
sprite_index= spr_nave_andando;
speed = -veloc;
}else{
sprite_index= spr_nave_parada;
speed = lerp(speed, 0, 0.05);
}
if keyboard_check(vk_left){
direc = 3;
}else if keyboard_check(vk_right){
direc = -3;
}else{
direc = lerp(direc, 0, 0.08);
}
if keyboard_check_pressed(vk_space){
var inst = instance_create_layer(x, y, "Instances", obj_projetil);
inst.speed = 6;
inst.direction = direction;
inst.image_angle = direction;
}
direction += direc;
image_angle = direction;
move_wrap(true, true, 0);
if alarm[0] > 0{
if image_alpha <=0{
alfa_add = 0.05;
}else if image_alpha >= 1{
alfa_add = -0.05;
}
image_alpha += alfa_add;
}else{
image_alpha += 1;
}
if vida <= 0{
game_restart();
}
asteroide_parent: if alarm[0] <= 0{
vida -= 1;
with (other) {
vida -= 1;
}
alarm[0] = 180;
}
Alarm[0]: // (空)
评论 (0)