How would you make pickup object that doesn’t trigger the screen...?

dale_coop

Moderator
Staff member
I would like to use pickup object as collectibles (money or ammo or...) but the « problem » is that pickup object make the screen « triggered ».

Of course, I still want to keep the pickup triggering functionality for my lockup titles, so...

How do you use pickup object without triggering the screen?

For now I use screen types, but it would be better if I could separate pickup objects and collectible ibjects.
(But couldn’t figure how to do)

A small video: https://youtu.be/jGjoB96p-wE


PressStartGamePlateform.png
 

dale_coop

Moderator
Staff member
I finally managed to modify the code, to make it work for my game.
In my case, I want normal key pickups that trigger the screen / unlock doors: which is the normal (current) behavior.
And I want some collectible pickups that don’t trigger the screen nor unlock doors, I want that pickups that just increase some variable (score, or money, or rubies, or ammo, ...)

What I do, is using "health" property of pickup objects, to do the difference.
If the pickup object has no health set, I consider it's a normal key lock pickup. And if there is health set (more than 0), I consider it's a collectible.


Collectible object Info.png


This is the script before (as you might have it) :
Code:
otherIsNotAMonsterTypeCollision:
	LDA ObjectFlags,y
	AND #%00100000 ;; is it a 'collectable'?
	BEQ otherIsNotAcollectable
	;;;; IS A pickup / power up
	DeactivateCurrentObject ;; makes the other object go away
							;; since other object is loaded in X
;;=========== WHAT DO YOU WANT TO HAVE HAPPEN WHEN YOU COLLECT THIS ITEM?
;;;;;;;ADD TO SCORE:
	 AddValue #$05, GLOBAL_Player1_Score, #$01
	LDA DrawHudBytes
	ORA HUD_updateScore
	STA DrawHudBytes
;;;;;;;;;;;;;;;;;;;;;


	;; JSR HandlePlayerPowerUp
	JSR countAllTargets

And this is the code after my modifications :

Code:
otherIsNotAMonsterTypeCollision:
	LDA ObjectFlags,y
	AND #%00100000 ;; is it a 'collectable'?
	BEQ otherIsNotAcollectable
	;;;; IS A pickup / power up
	DeactivateCurrentObject ;; makes the other object go away
							;; since other object is loaded in X
;;=========== WHAT DO YOU WANT TO HAVE HAPPEN WHEN YOU COLLECT THIS ITEM?
	LDA Object_health,x  ;; check the value of "health"
	;; if zero it's a normal key lock pickup 
	BEQ continueOtherIsNotAMonsterTypeCollision
	;; if different than zero, it's a collectible pickup	
;;;;;;;ADD TO SCORE:
	AddValue #$05, GLOBAL_Player1_Score, #$01
	LDA DrawHudBytes
	ORA HUD_updateScore
	STA DrawHudBytes
	JMP doneWithThisObjectCollision
;;;;;;;;;;;;;;;;;;;;;


	;; JSR HandlePlayerPowerUp
continueOtherIsNotAMonsterTypeCollision:
	JSR countAllTargets


It's an early code, in this exemple, the collectible just increase the SCORE. Now I will use it to charge the weapon of my player (maybe with the value set in the health property).

If you have suggestions, comments, I'd happy to hear :) thank you
 

dale_coop

Moderator
Staff member
Unfortunately, yes for the key pickups objects, that trigger the screen (unlock the doors), still make monster SubPal#1 goes wrong.I could reproduce that in the pi version too (not only the empty one).
 

Rob Burrito

New member
dale dont forget in the last tutorial i found the triggered monsters skip to monster palette 32 by default, so you can just copy your OG palette to 32 for now?
 
Dale I tried your code and now everything is working for me. I have my regular pick ups and key pick ups. Collecting the regular pick ups are no longer changing monster palette upon collection and are acting as my score pickups as intended, and key pick ups are triggering corresponding locks on intended screens.
 

dale_coop

Moderator
Staff member
Rob Burrito said:
dale dont forget in the last tutorial i found the triggered monsters skip to monster palette 32 by default, so you can just copy your OG palette to 32 for now?

Oh thanks, Rob Burrito! Sure, it must be that. I just duplicate my monster colors in the palette 32.
Will try that today at my lunch time
 

dale_coop

Moderator
Staff member
Ok, I think I fixed the problem of monster's palette in triggered screen.

The problem is in the "GameEngineData\Routines\System\LoadScreenData.asm".
Go to the line 319, it should currently look like that:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; got monster group
	INY
	LDA (temp16),y
	ASL
	ASL
	STA temp
	INY
	LDA (temp16),y
	LSR
	LSR
	LSR
	LSR
	LSR
	LSR
	ORA temp
	AND #%00111111
	STA newObj1Pal
;;;;;;;;;;;;;;;;;;;;;;;;;;;; got object pal 1

Then modify the code to be like that:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; got monster group
	LDA #SCREEN_DATA_OFFSET
	CLC
	ADC #$1B
	TAY
	LDA (temp16),y
	ASL
	ASL
	STA temp
	INY
	LDA (temp16),y
	LSR
	LSR
	LSR
	LSR
	LSR
	LSR
	ORA temp
	AND #%00111111
	STA newObj1Pal
;;;;;;;;;;;;;;;;;;;;;;;;;;;; got object pal 1

It should be fixed.

I hope Joe can come by and verify the code, if I don't brake something else doing that... (because I am not 100% sure of what I am doing) :p
 

dale_coop

Moderator
Staff member
It was for the beta version. Now in the new version of NESMaker (the official version), it's quite different. But easier !
Just use Game Objects : key pickup, health pickup, coin pickup...
And you can assign script to each of them, in the Project Details ("Power Up 00" to 03).
These pickups don't trigger the screen!
 
Top Bottom