[4.5.6] Make you unable to kill certain enemies

Post Reply
Hector Valle
Posts: 9
Joined: Sat Aug 01, 2020 5:04 pm

[4.5.6] Make you unable to kill certain enemies

Post by Hector Valle » Fri Sep 04, 2020 1:44 am

Hello Guys! I'm trying to implement "spike enemies" in my platform game, but obviously I can beat them if I jump on them because that's how it is set in the hurtPlayer_PlataformerBase.asm Try placing this little piece of code on top:

LDA Object_type, x
CMP #$12 (that's the number of my enemy)
BNE + skipDoingThis


Now what happens is that if I jump on any enemy, I die as if it were the enemy with spikes. Can someone help me fix this please?
Pauldalyjr
Posts: 102
Joined: Wed Sep 12, 2018 4:01 am
Location: Tennessee

Re: [4.5.6] Make you unable to kill certain enemies

Post by Pauldalyjr » Fri Sep 04, 2020 8:01 am

Take that added bit of code out, In your monster object settings put the monster life at 0. Not sure this is exactly what you are looking for, you'll have an invincible monster.
User avatar
nathanlurker
Posts: 67
Joined: Tue Apr 07, 2020 3:56 pm
Location: Montreal, Canada

Re: [4.5.6] Make you unable to kill certain enemies

Post by nathanlurker » Fri Sep 04, 2020 12:39 pm

I think this is your answer :
BNE will branch out if not equal. so when you compare with object #$12, if it is any other object, it will branch out to +skipDoingThis. What you want is BEQ instead of BNE. It will branch out if equal. We compare with 12, it is equal, we skip the stuff. if it's not 12, we don't skip, we actually do the jump on stuff.

Code: Select all

LDA Object_type, x
CMP #$12 (that's the number of my enemy)
BEQ + skipDoingThis
	;;here we do the stuff if it wasn't object #$12
+ skipDoingThis
Hector Valle
Posts: 9
Joined: Sat Aug 01, 2020 5:04 pm

Re: [4.5.6] Make you unable to kill certain enemies

Post by Hector Valle » Fri Sep 04, 2020 3:25 pm

I applied that, but the problem still happen
Hector Valle
Posts: 9
Joined: Sat Aug 01, 2020 5:04 pm

Re: [4.5.6] Make you unable to kill certain enemies

Post by Hector Valle » Fri Sep 04, 2020 3:31 pm

I put this:

LDA Object_type, x
CMP #$12
BEQ +Mortal
JMP +doHurtPlayer
+Mortal
User avatar
TolerantX
Posts: 88
Joined: Fri Jan 18, 2019 7:58 am

Re: [4.5.6] Make you unable to kill certain enemies

Post by TolerantX » Mon Sep 14, 2020 7:46 am

I just make the enemies I don't want to kill into a different type.. primarily monster weapon and remove the destroy object from it in my collisions. it's a simple workaround.
Post Reply