【发布时间】:2015-06-24 11:57:42
【问题描述】:
此代码会在其生命值达到 0 时销毁该对象,但不会将 5/7 添加到 global.xp 变量中。
if rotem_hp > 1 and shop_13 = 0
{
rotem_hp = rotem_hp -1
}
else
{
if rotem_hp > 1 and shop_13 = 1 rotem_hp = rotem_hp -1.5
if rotem_hp < 1 and shop_4 = 0 global.xp = global.xp + 5 instance_destroy()
if rotem_hp < 1 and shop_4 = 1 global.xp = global.xp + 7 instance_destroy()
}
这也行不通
if (rotem_hp > 1 and global.shop_13 = 0)
{
rotem_hp = rotem_hp -1
}
else if (rotem_hp > 1 and global.shop_13 = 1)
{
rotem_hp = rotem_hp -1.5
}
else if (rotem_hp < 1 and global.shop_4 = 0)
{
global.xp = global.xp +5
instance_destroy()
}
else if (rotem_hp < 1 and global.shop_4 = 1)
{
global.xp = global.xp +7
instance_destroy()
}
else
{
//do nothing
}
这不会破坏对象(顺便说一句,我有创建事件(rotem_hp = 5)
if rotem_hp > 1 and global.shop_13 = 0
{
rotem_hp = rotem_hp -1
}
if rotem_hp > 1 and global.shop_13 = 1
{
rotem_hp = rotem_hp -1.5
}
if rotem_hp < 1 and global.shop_4 = 0
{
global.xp = global.xp +5
instance_destroy()
}
if rotem_hp < 1 and global.shop_4 = 1
{
global.xp = global.xp +7
instance_destroy()
}
感谢您为回答我的问题所做的任何努力。
【问题讨论】:
-
您可以更新您的答案以包含添加为注释的代码
-
什么问题?你想要什么?
shop_13和shop_4是什么?你用了什么活动? -
Global.shop 变量是当我在商店购买东西时,它会将其变量设置为 1 而不是 0,因为它是真的(布尔值或其他东西)。
-
它可以提供额外伤害或经验值,如您所见
标签: game-maker gml