Collision Problems? Maybe..
JGary321
Member Posts: 1,246
Not sure if this is a bug or not. I have waves of enemies attack my tower. Lets say there are 10 enemies. I have them spawn an attack animation. I have a rule on my tower that says
When Tower collides with CPU Attack then change attribute
HP to HP - CPU Attack.
The problem is that it only registers 1 hit, even if I have like 10 attack animations being played. Now if I reverse this & put a rule on the CPU attack like this:
When CPU Attack collides with Tower change attribute
HP to HP - CPU Attack.
This 2nd way registers every hit. What's the problem you ask? I have 1 tower, so it's easy to set game attributes for everything. But I have tons of the same type of enemies (instanced). I can't do this for the enemies, b/c each enemy has a different HP. I have the HP for enemies set in each instance. Thats why I need the damage modifiers to be placed on the enemy.
So can any Mods tell me if this is a collision bug? But I don't see why it would register when I put the rule on attack, but not on the Tower.
When Tower collides with CPU Attack then change attribute
HP to HP - CPU Attack.
The problem is that it only registers 1 hit, even if I have like 10 attack animations being played. Now if I reverse this & put a rule on the CPU attack like this:
When CPU Attack collides with Tower change attribute
HP to HP - CPU Attack.
This 2nd way registers every hit. What's the problem you ask? I have 1 tower, so it's easy to set game attributes for everything. But I have tons of the same type of enemies (instanced). I can't do this for the enemies, b/c each enemy has a different HP. I have the HP for enemies set in each instance. Thats why I need the damage modifiers to be placed on the enemy.
So can any Mods tell me if this is a collision bug? But I don't see why it would register when I put the rule on attack, but not on the Tower.
Comments
The way Rules work is it checks if the conditions are true. If something else happens to make a condition true, it doesn't make it any more true than it already is, so it doesn't reactivate the rules inside.
You flip on a light switch, the light is on. If you flip it on again(and not off then on) nothing happens.
On my game I have an archer char. I have a 'range actor' attached. On collision or overlap it spawns actor 'arrow'. My problem is that it does not continuously attack. I understand based off your previous post it only checks once.
Is there a way to make it so that every .5 secs if they overlap it will still spawn the actor for as long as they overlap? Currently it will only spawn on first collision. I've tried using a timer to no effect. I basically need a way to refresh the rule so that it constantly checks.
Thanks. JGary.
Rule: If collides with actor
Timer every .5 sec Spawn Actor
And does the thing that gets spawned get destroyed.
Actor 1:
--Rule: If Collides with Actor 2,
----Timer Every .5sec Spawn Actor: Actor3
Actor 2: If collides with Actor3, increment counter
Actor 3: If collides with Actor2: Destroy Actor
I added 2 instances of actor 1 on top of each other, and 2 different sized Actor2 actors to the scene with all of them sharing one line as a border. The actor2 actors were displaying their hit counters and both were going up by 2 every .5 seconds.
So you could use this method for doing attacks and catching multiple hits.
I like gangs of zombie ninja monkeys, they are cool. Idea / title for a game there!
I have archer (actor 1) who spawns a range actor (actor 2, it's constrain to x,y of actor 1). Then I have a line of mobs (actor 3) come toward the archer. The archers continue to attack and spawn arrows (actor 4) as long as a new mob collides with my range actor (actor 2). My range actor is 200w. So it takes up half the screen almost. I can send you the file tonight when I get home if you like.
I assume when you put in the counter that was just to show you that it was working right? Also, how long was actor 1?? Did actor 2 stop when it hit actor 1? Reason I ask is that it seems like if actor 3 (mob) collides with actor 1 (archer) it will continue to spawn the arrows (actor 4). Thanks for the help.