This code does destroy the object when its health reaches 0 but it won't add 5/7 to the global.xp variable.
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()
}
This wont work either
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
}
This wont destroy the object (btw in create event i have (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()
}
I will appreciate any efforts to answer my question.