Go through floor for only certain objects

I am working on a megaman game and I am trying to make a gravity gun, normally the enemy telly will fly through the floor. But when its shot with the gravity gun I want it to bounce towards megaman. So I tried to use solid for the floor value but that made it so if the enemy came from under megaman he would go through the floor and sometimes the telly would get stuck if he was touching multiple floor objects. I need the telly to be able to fly through the floor but not effect megaman going through when the variable grav=0 and bounce when grav=1 but i've been doing this for hours and whenever i put in a collision check event on the telly he automatically acts as a solid and gets stuck.

Edited by _257502, 13 July 2012 - 08:34 PM.

0

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.

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!

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?

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.

0

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.

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.

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!

0

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.

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!

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!

Just a tip, you can just check the hp var in destroy event to check if the object was actually killed by the player.If it was destroyed by the system then the hp would still be > 0 so no need to play the death animation and sounds...

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.

0

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.

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.

What I mean was for example...

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...