View Single Post
chandie

JCF Member

Joined: Jan 1970

Posts: 19

chandie has disabled reputation

Mar 10, 2020, 08:09 AM
chandie is offline
Reply With Quote
Walking Enemy

Quote:
Originally Posted by Violet CLM View Post
You are running into an issue where killing it using a physical attack fails to cause the level to end, but jObjectPresets[OBJECT::NORMTURTLE].playerHandling = HANDLING::ENEMY; should fix that. Also you probably don't want STATE::KILL to call boss.deactivate().
Thanks for the tips Violet. Yeah with playerHandling command EOL works with physical attack.


Quote:
Originally Posted by Violet CLM View Post
Sure... jjSetWaterLevel exists. You may need to figure out nObjectHit">jjBEHAVIORINTERFACE and its onObjectHit method, though, since I'm guessing you want the object to react only to being shot by bullets, not to being buttstomped.
I solved jjSetWaterLevel with switchtrigger. so it works fine with a trigger zone. but objecthit with bullet seems a little more complicated but I'll keep working on it. Yeah it shouldn't work by buttstomping.


And I have a one last question. I am trying to create a walking enemy from Frog animations. It works but the animation plays under the ground sprite. Here's the code:

Code:
void onLevelLoad() {

	jjObjectPresets[OBJECT::LIZARD].behavior = Frog;
	jjObjectPresets[OBJECT::LIZARD].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::LIZARD].playerHandling = HANDLING::ENEMY;

}




void Frog(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::WALKINGENEMY, false);
	obj.determineCurAnim(ANIM::FROG, 12);
	obj.determineCurFrame();
	obj.putOnGround(true);


jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL, 0);


}
I've tried some other things like setting WALKINENEMY value to true but it didn't change anything. I've also try adding some negative values to obj.yPos in jjDrawSpriteFromCurFrame. It helps visually. But functionally the enemy is still under the ground. Any suggestions ar highly appreciated. Thank you.