Edited by _257502, 13 July 2012 - 08:34 PM.
Go through floor for only certain objects
#1
Posted 21 April 2012 - 05:41 AM
#2
Posted 23 April 2012 - 02:51 AM
#3
Posted 23 April 2012 - 04:13 AM
#4
Posted 23 April 2012 - 04:48 AM
Just noticed your question for the first time. instance_change is a no-no? Oh oh, been using it for my game and love it (for certain circumstances). Wonder what it is about that function that you heard?Ok, apparently no one is seeing this thread but I might have solved my problem with an instance change even thought i know its a big no no its all I can think of!
#5
Posted 23 April 2012 - 06:28 PM
Just noticed your question for the first time. instance_change is a no-no? Oh oh, been using it for my game and love it (for certain circumstances). Wonder what it is about that function that you heard?
I don't remember where I heard it but in my own experience using instance codes usually cause more problems than they solve. But I tried it anyway and it completely solved my problem all I had to do was make another object with a different movement code and change to it on collision.
#6
Posted 23 April 2012 - 06:52 PM
Just noticed your question for the first time. instance_change is a no-no? Oh oh, been using it for my game and love it (for certain circumstances). Wonder what it is about that function that you heard?
I don't remember where I heard it but in my own experience using instance codes usually cause more problems than they solve. But I tried it anyway and it completely solved my problem all I had to do was make another object with a different movement code and change to it on collision.
Yeah, I like using instance_change. It seems to me however that an instance_destroy of current object and instance_create of new object may do the same thing. I'm sure there's more to experiment with here.
#7
Posted 24 April 2012 - 04:20 AM
Yeah, I like using instance_change. It seems to me however that an instance_destroy of current object and instance_create of new object may do the same thing. I'm sure there's more to experiment with here.
Yeah it does the same thing, either way caused a death animation i had to happen when i changed instances. So I needed to add a health variable to cause the destroy event not to trigger but it seems to work perfect now!
#8
Posted 24 April 2012 - 07:31 AM
Yeah it does the same thing, either way caused a death animation i had to happen when i changed instances. So I needed to add a health variable to cause the destroy event not to trigger but it seems to work perfect now!
It works perfect with destroy and create, or just change?
#9
Posted 24 April 2012 - 09:07 AM
Just a tip, you can just check the hp var in destroy event to check if the object was actually killed by the player.
Yeah, I like using instance_change. It seems to me however that an instance_destroy of current object and instance_create of new object may do the same thing. I'm sure there's more to experiment with here.
Yeah it does the same thing, either way caused a death animation i had to happen when i changed instances. So I needed to add a health variable to cause the destroy event not to trigger but it seems to work perfect now!
If it was destroyed by the system then the hp would still be > 0 so no need to play the death animation and sounds...
#10
Posted 24 April 2012 - 04:20 PM
#11
Posted 25 April 2012 - 12:59 AM
What I mean was for example...Did the change and it works fine, its less code to do and as far as the hp variable I did that its just weird that when you do a change it actually triggers the destroy event to instead of just replacing it.
In obj_monster's Destroy event:
var anim;
if hp <= 0 //--actually killed by attacks rather than the system
{
sound_play(snd_monster_aarrgh);
//--a cheap way to play the death animation after instance is destroyed:
anim=instance_create(obj_anim);
anim.sprite_index=spr_monster_death;
}
In obj_anim's Animation End event (under Other):
instance_destroy();
This won't trigger the death event (just don't a trigger) unless you have something else going on.
The code to destroy the monster should be either at time of attack or you can dump a health-check in step or something...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











