【GMS2】求教 image_index的判断问题
gamemaker吧
全部回复
仅看楼主
level 8
逐光Dream 楼主
代码是在User Event 2 里执行:
if ( a_dir >= 45 and a_dir < 90)
{sprite_index = p_d_atk1_1}
if (a_dir >= 0 and a_dir < 45)
{sprite_index = p_d_atk1_2 }
if (a_dir >= 315 and a_dir < 360)
{sprite_index = p_d_atk1_3 }
if (a_dir >=270 and a_dir < 315)
{sprite_index = p_d_atk1_4 }
if ( a_dir >= 90 and a_dir < 135)
{sprite_index = p_d_atk1_1}
if (a_dir >= 135 and a_dir < 180)
{sprite_index = p_d_atk1_2}
if (a_dir >= 180 and a_dir < 225)
{sprite_index = p_d_atk1_3}
if (a_dir >= 225 and a_dir < 270)
{sprite_index = p_d_atk1_4}
if (image_index == 2 ) {
instance_create_layer(x,y,"instances_3",o_jianqi)
}
但是image_index == 2却不会执行instance_create_layer(x,y,"instances_3",o_jianqi)
求大佬解决![乖]
2018年07月15日 03点07分 1
level 12
image index可以不是整数,所以它不一定会等于2
2018年07月15日 03点07分 2
但它总有一个时刻会等于2对吧?我就是想要它等于2的那一个时刻执行
2018年07月15日 04点07分
@逐光Dream 这还真不一定。。例如图片播放速度0.2,假设当前step图片索引为1.9,则下一step时图片索引就是2.1了。本人亲测。
2018年07月15日 07点07分
这样的吗?[惊讶]
2018年07月16日 02点07分
2018年07月16日 03点07分
1