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

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

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

Post by dale_coop » Sat Jul 14, 2018 7:12 pm

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
PressStartGamePlateform.png (8.19 KiB) Viewed 545 times
Last edited by dale_coop on Mon Jul 16, 2018 6:16 am, edited 1 time in total.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1284
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Mon Jul 16, 2018 6:08 am

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
Collectible object Info.png (32.85 KiB) Viewed 523 times

This is the script before (as you might have it) :

Code: Select all

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: Select all

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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dark_crow_66
Posts: 97
Joined: Wed Apr 18, 2018 1:59 pm

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

Post by dark_crow_66 » Mon Jul 16, 2018 9:01 pm

Awesome Dale. I'm going to try this tonight. Ate keys still changing color of monsters when triggered?
User avatar
dale_coop
Posts: 1284
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Mon Jul 16, 2018 10:05 pm

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).
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
Rob Burrito
Posts: 100
Joined: Mon Apr 23, 2018 4:31 pm

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

Post by Rob Burrito » Tue Jul 17, 2018 1:30 am

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?
User avatar
dark_crow_66
Posts: 97
Joined: Wed Apr 18, 2018 1:59 pm

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

Post by dark_crow_66 » Tue Jul 17, 2018 5:14 am

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.
User avatar
dale_coop
Posts: 1284
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Tue Jul 17, 2018 5:55 am

Rob Burrito wrote:
Tue Jul 17, 2018 1:30 am
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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
dale_coop
Posts: 1284
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Tue Jul 17, 2018 3:51 pm

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: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
User avatar
Rob Burrito
Posts: 100
Joined: Mon Apr 23, 2018 4:31 pm

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

Post by Rob Burrito » Thu Jul 19, 2018 12:39 am

awesome Dale! i'll give it a shot
User avatar
dale_coop
Posts: 1284
Joined: Fri Feb 16, 2018 7:05 am
Location: France

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

Post by dale_coop » Tue Aug 14, 2018 10:18 pm

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!
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply