process deleting a process this way no longer works

Started by MisterN, June 25, 2012, 04:54:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN


//being attacked
        if(procID = collision(type bullet_1))
            signal(procID,s_kill);
            health-=1;
        end
        if(procID = collision(type throw_1))
            signal(procID,s_kill);
            health-=2;
        end
        if(procID = collision(type hit_wave))
            if(weps.can_hurt==true)
                health-=1;
                weps.can_hurt=false;
            end
        end


Its detecting a collision with the process but its no longer killing said process. Now if I make the process it collides with something like the player, then it will work. But howcome its not deleting a simple process thats colliding with it? Thanks

EDIT:
I put say("hit!"); in the bullet_1 process and I saw it come up 5 times in console (the enemy has 5 health). now I also tried making it so the bullet was only deleted when it collided with the enemy, and when the enemy collided with the bullet it took damage; that worked somewhat but the bullet would be deleted before damage would be taken most of the time. I know for sure the game is not spawning the enemy more than once (and they are just layered over eachother) because of how I set up the AI (and I have a console message telling me how many there are and where they are at). Thanks

werg

handsource-dyko

Could you be a bit more specific?  ??? I quickly tested the game and it seems to work fine.
Maybe it's a problem with the sequence of commands, signals respond imidiately, maybe you want
some delay? With signals the exact order is important, changing the order can make a lot of difference.

When you've got a chain of collisions, e.g. multiple bullet hits with an enemy, the enemy may kill
the bullet, but the bullets after the enemy kill maybe left in limbo if their processes are not killed by some
other check (in the bullet process itself). A process can also kill itself if you tell it to do so, e.g. with Signal(id,s_kill);
In this case the id value is the id of the process instance iself in wich the signal command is placed.

In the case of the bullets, you can create an extra check inside the bullet process to see if it was killed by the
enemy, if not, the bullet has to kill itself.


I think this is your design intend?

SplinterGU

DoctorN, can you share a complete sample source code?
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

Quote from: handsource-dyko on June 26, 2012, 12:46:06 PM
I quickly tested the game and it seems to work fine.

Wait, for you the bullet deletes when it collides with the enemy? How?

Quote from: handsource-dyko on June 26, 2012, 12:46:06 PM
In the case of the bullets, you can create an extra check inside the bullet process to see if it was killed by the
enemy, if not, the bullet has to kill itself.

How do I do that?
werg