如何在游戏制作者满足条件时生成对象

0 game-maker

我一直在制作游戏制作者的游戏,当我达到一定的分数时,我想要一个物体在我的房间里产卵.我试过这样做:

if global.score >= 10
{
    instance_create(obj_flag);
}
Run Code Online (Sandbox Code Playgroud)

但当我去运行它时,它说"函数instance_create的参数数量错误"

如果有人能帮助我,我将不胜感激.谢谢

rra*_*nza 5

我不认识游戏制作者,但快速谷歌搜索显示instance_create()需要三个参数,因此关于错误数量的参数错误:

http://gamedesign.wikidot.com/gamemaker:instance-create

id = instance_create( x, y, obj );

 id = returned instance id
  x = x location to create object
  y = y location to create object
obj = name of object to create an instance of

instance_create() creates an instance of an object at 
the specified x/y coordinates. It also returns the instance 
id of the instance created, which can be put into a variable
and used to manipulate the instance.
Run Code Online (Sandbox Code Playgroud)

因此看起来API要求您指定创建它的位置.