[4.1] Adding the Jump on Kills flag for the monster objects in the platformer module

Post Reply
User avatar
dale_coop
Posts: 2092
Joined: Fri Feb 16, 2018 7:05 am
Location: France

[4.1] Adding the Jump on Kills flag for the monster objects in the platformer module

Post by dale_coop » Thu Jan 10, 2019 12:41 pm

In the 4.1, the "Jump On Kills" on Monster Objects is no more here. Here's how to bring back that feature in the platformer module, for those who love it so much.

Image


Note: First thing to know, in the 4.0.11 the "Jump On Kills" was using the #$00001000 value for Object_vulnerability, but in the 4.1 this value is used for something else (the "No Hurt Recoil"). So instead, I will use the #$00010000 value labelled "Ignore Solid Collision" in the 4.1... because in fact, in the code, this seems not to be used.


1/ In your "Project Settings > Project Labels", rename the Monster Action Step Flag "Ignore Solid Collision" to "Jump On Kills" :

Image


2/ Duplicate your "HandleObjectCollisions.asm" script located in the "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer" folder and name it, for example, "HandleObjectCollisions_withJumpOnKills.asm".

Now, modify the new "HandleObjectCollisions_withJumpOnKills.asm" script, around line 190, from that:

Code: Select all

playerWasNotHurtDuringCollision:
	LDA Object_vulnerability,x
To that:

Code: Select all

playerWasNotHurtDuringCollision:
;;---- Jump On Kills code begin ----
	TYA
	STA tempy
	LDX tempx
	LDA Object_vulnerability,x
	AND #%00010000
	BNE jumpOnMonster
	LDX player1_object
	JMP dontJumpOnMonster
jumpOnMonster:
	LDX player1_object
	;TXA
	;STA tempx
	;JMP playerWasHurtDuringCollision
	;LDX player1_object
	LDA selfBottom
	CMP otherCenterY
	BCS dontJumpOnMonster
	;;; JUMP ON MONSTER
	LDX player1_object
	LDA #$00
	SEC
	SBC #$04
	STA Object_v_speed_hi,x
	LDX tempx
	DeactivateCurrentObject
	
	PlaySound #SND_SPLAT
	
	LDY tempy
	;; INCREASE SCORE
	AddValue #$08, myScore, #$01, #$00
	UpdateHud HUD_myScore	
	JMP playerWasHurtDuringCollision ;; just skips collision
dontJumpOnMonster:
;;---- Jump On Kills code end ----

	LDA Object_vulnerability,x
3/ In your "Project Settings > Script Settings", select the "HandleScreenLoads Object Collision" element and assign the "HandleObjectCollisions_withJumpOnKills.asm" script.

Image


4/ On your monster object, you should now be able to use the "Jump On Kills" flag.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
torseelos
Posts: 6
Joined: Sat Jan 05, 2019 12:44 am

Re: [4.1] Adding the Jump on Kills flag for the monster objects in the platformer module

Post by torseelos » Thu Jan 10, 2019 7:43 pm

The biggest thank you for the work around !!!
Works fine for me!
User avatar
dale_coop
Posts: 2092
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding the Jump on Kills flag for the monster objects in the platformer module

Post by dale_coop » Thu Jan 10, 2019 9:19 pm

You’re welcome. Glad it worked for you too:)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
stevecrucial
Posts: 2
Joined: Wed Jan 09, 2019 4:37 pm

Re: [4.1] Adding the Jump on Kills flag for the monster objects in the platformer module

Post by stevecrucial » Thu Jan 10, 2019 9:33 pm

Yes it works! Thank you Dale!
Post Reply