Destroy object after 3 hits
#1
Posted 13 October 2010 - 08:47 PM
I'm working on a tds and I need some little help
I have a crate that I want to explode after 3 bullet hits(The crate it's a w3d object)
Ho can help me?
#2
Posted 13 October 2010 - 08:52 PM
#3
Posted 13 October 2010 - 08:59 PM
#4
Posted 13 October 2010 - 09:03 PM
It's a fake 3DSo its 3d?
#5
Posted 13 October 2010 - 09:13 PM
(Create)
hits= 3
(On contact with bullet)
hits-=1
(Step Event)
if hits < 1
{
instance_destroy()
}
You could also use hp in place of hits... then its more damage based...
#6
Posted 13 October 2010 - 09:14 PM
hits = 0;
Then in the collision event from the bullet against the crate:
other.hits += 1; if other.hits > 2 with (other) instance_destroy();
#7
Posted 13 October 2010 - 09:22 PM
OK then in the create event of the crate set up a variable 'hits' with value 0:
hits = 0;
Then in the collision event from the bullet against the crate:other.hits += 1; if other.hits > 2 with (other) instance_destroy();
___________________________________________
ERROR in
action number 1
of Collision Event with object obj_bullet
for object obj_crate1:
Error in code at line 1:
other.hits += 1;
^
at position 1: Unknown variable hits
#8
Posted 13 October 2010 - 09:24 PM
#9
Posted 13 October 2010 - 09:38 PM
#10
Posted 13 October 2010 - 10:37 PM
on collision bullet with crate
set timeline cratehit (Not code)
Timeline:
at 0;
sprite_index = crate_hitat 9;
sprite_index = crate_normal
For an explode:
Crate step:
if hits < 1
{
instance_change(explosion,0)
}
Explosion object end animation:instance_destroy()Send me a message via pm if you need anything else.
Edited by Travis123, 13 October 2010 - 10:45 PM.
#11
Posted 13 October 2010 - 10:55 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











