游戏制作者语言:place_meeting似乎不起作用

时间:2017-11-04 08:35:34

标签: game-maker game-maker-language game-maker-studio-1.4

我正在制作类似吃豆人的游戏,我想重新制作吃豆人迷宫,但我想让自己更容易,所以当我改变墙壁放置时它会自动改变方式墙看起来。我的pac-man sprite以及我的墙壁精灵是16px * 16px。以下是墙精灵图片:Imgur。这是房间编辑室内的房间:Imgur。以下是它在游戏中的表现:Imgur。 这是我在obj_wall的创建事件中的代码:

image_speed = 0;

//see where we have blocks
up = place_meeting(x, y - 16, obj_wall);
upright = place_meeting(x + 16, y - 16, obj_wall);
right = place_meeting(x + 16, y, obj_wall);
downright = place_meeting(x + 16, y + 16, obj_wall);
down = place_meeting(x, y + 16, obj_wall);
downleft = place_meeting(x - 16, y + 16, obj_wall);
left = place_meeting(x - 16, y, obj_wall);
upleft = place_meeting(x - 16, y - 16, obj_wall);

//determine how should the wall look
if(up && upright && right && downright && down && downleft && left && upleft)
{
    image_index = 3;
}
if( (down && up && !left) || (down && up && !right) )
{
    image_index = 1;
}
if( (right && left && !up) || (right && left && !down) )
{
    image_index = 1;
    image_angle = 90;
}
if( (right && down && !downright) || (right && down && !upleft && !left && !up) )
{
    image_index = 2;
}
if( (up && left && !upleft) || (up && left && !downright && !right && !down) )
{
    image_index = 2;
    image_yscale = -1;
    image_xscale = -1;
}
if( (up && right && !upright) || (up && right && !downleft && !left && !down) )
{
    image_index = 2;
    image_yscale = -1;
}
if( (down && left && !downleft) || (down && left && !upright && !up && !right) )
{
    image_index = 2;
    image_xscale = -1;
}

我正在使用Game Maker Studio 1.4

1 个答案:

答案 0 :(得分:0)

没关系,我解决了它。因为在第三个'if'中我改变了image_angle,所以我应该在所有其他'if's

中撤消它