Writerstix77
Member
I have 10 different types of currency. When the player interacts with a certain type of currency he is given a random amount of money within a given range, depending on what the currency is. Currently I have 10 different Collision events (in oPlayer) that all look incredibly similar. All currency objects are children of the parent object Collectable_parent.
Collision with oCoin:
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
money += irandom_range(1, 10);
Collision with oRuby:
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
money += irandom_range(25, 100);
Etc. Etc.
Is there a cleaner way to say
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
and if (other) is a coin, then: money += irandom_range(1, 10);
if (other) is a ruby, then: money += irandom_range(25, 100);
and so on, in a Collectable_parent Collision event? I've tried playing around with it, but it keeps kicking back errors. Any suggestions are appreciated. Thanks so much.
Collision with oCoin:
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
money += irandom_range(1, 10);
Collision with oRuby:
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
money += irandom_range(25, 100);
Etc. Etc.
Is there a cleaner way to say
with(other)
{
audio_play_sound(Coin_collect_SFX, 1, false)
instance_destroy();
}
and if (other) is a coin, then: money += irandom_range(1, 10);
if (other) is a ruby, then: money += irandom_range(25, 100);
and so on, in a Collectable_parent Collision event? I've tried playing around with it, but it keeps kicking back errors. Any suggestions are appreciated. Thanks so much.