Collision Problems? Maybe..

JGary321JGary321 Member Posts: 1,246
edited November -1 in Working with GS (Mac)
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.

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Imagine you are getting beat up by a gang of zombie ninja monkeys. In your first case, it is equivalent to, 'Am I getting hit?" rather than "How many times did I get hit?". You aren't concerned that there is a whole gang of them as much as you are concerned that they are quietly trying to eat your brain.

    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.
  • JGary321JGary321 Member Posts: 1,246
    What would you do to get around this? I need for each hit to register. Since I am spawning about 10 instances of the same mob I haven't figured a way to not have the HP on the mobs themselves. But I need to make sure each hit registers. Any ideas?
  • JGary321JGary321 Member Posts: 1,246
    Alright, so I reworked how attacks were done. I got my previous issue fixed. But I am having another collision issue though & need some Moderator input.

    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.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    so your rule looks like this:

    Rule: If collides with actor
    Timer every .5 sec Spawn Actor

    And does the thing that gets spawned get destroyed.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I just did a test game.
    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.
  • TobyToby Member Posts: 478
    But what if the gang of zombie ninja monkeys, have guns and consumed lots of beans and suffer from extreme flatulence?

    I like gangs of zombie ninja monkeys, they are cool. Idea / title for a game there!
  • JGary321JGary321 Member Posts: 1,246
    CodeMonkey, that's basically exactly what I have.

    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.
Sign In or Register to comment.