Alright, I decided to try and apply this to Moto Bug for fun. I managed to get it to where Sonic could not kill him in one hit (by changing the ColType of Moto to the one GHZ Robotnik uses. I'm not sure that was the right way to go about it.) Though, after a hit, Sonic can longer interact with him. I tried looking at GHZ Robotnik to give Moto Bug similar hit-by-Sonic routines, but it seems like the branch stuff Robotnik uses (loc_1783C and similar stuff) can't be used by another object. However, Moto Bug would have to use new "loc"s for his branches, wouldn't he?
You'll have to make a new routine for the badnik. Using Eggman's code isn't going to work. Does Coltype stand for collision type? That shouldn't be changed.
Try this for testing purposes.
Use an unused RAM address for the badnik hits (a byte long will do). And another unsed ram address for the badnik timer (byte long again). Call these (badnikhit).w and (badniktimer).w
When the badnik is created, set the (badnikhit).w to 4. And (badniktimer).w to 0.
When you go to hit a badnik, it will jump to a routine somewhere to kill the badnik. At that routine, try adding this first:
Killbadnikroutine: tst.b (badniktimer).w ; Is it 0? beq.s + ; Yes? skip then rts + tst.b (badnikhit).w ; Is it 0? beq.s + ; Yes? Kill badnik subq.b #1,(badnikhit).w ; Subtract 1 from hit move.b #$20,(badniktimer).w ; Start timer rts + ; etc
So when it goes to kill the badnik, unless the (badnikhit).w is 0, it will not kill the badnik. It will subtract 1 from it for the next hit. It will then start the timer, to make the badnik invulnerable for a short period.
Then, in the badnik's main code, try this:
tst.b (badniktimer).w ; Is it 0? beq.s + ; Yes? skip then subq.b #1,(badniktimer).w ; Subtract 1 from from timer + ; etc
Unless timer is 0, it will keep counting it down. So now, when it does eventually reach 0, the badnik can be hit again.
After 4 hits, the badnik should then die.
This is all from the top of my head. You might want to tweak it. If this works, you will then want to get rid of using RAM addresses and use the badniks own SSTs, like instead of (badnikhit).w, use obj_off30(a0). The only problem is, all badniks will take the new killbadnik routine into account, and might use that particular offset for something different.
EDIT: Quoted previous post because of page-break. I have a habit of breaking pages recently.