Objects on Title Screen [4.15]

crazygrouptrio

Active member
Want to bring life to your title screen by using some game objects? Maybe add some characters or star sparkles to your title? Turns out it's really easy!
091cgdD.gif


UPDATE: The only script we need to modify for this is HandleScreenLoads (located in Routines>Basic>System), so maybe back that up if you're worried about messing it up but we'll only be adding lines so it's not very invasive.
Near the end of the script you'll see this:
Code:
	LDA gameHandler
	ORA #%10000000
	STA gameHandler
	LDA #$00 
	STA update_screen
	STA canUpdateScreen
	LDA #%00011110
	STA soft2001
just after this, paste the following code.
Code:
titleScreenObjects::
	LDA update_screen_details
	BEQ +
	JMP ++
+	
	;; is special screen:
	LDA newScreen
	CMP #$01
	BNE +
	JMP ++
	+
	;; StartScreen:

CountObjects #%00001000, #$00   ;; count monsters on screen
    LDA monsterCounter              ;; the variable used to count is monsterCounter
    CLC
    CMP #$02        ;; compare to 2
    BCC +       ;; if less than 2 on screen we can create a monster
    JMP ++         ;; else we quit
    +	
	CreateObject #$00, #$00, #$0E, #$00, temp ;; game object 14 
	CreateObject #$55, #$B1, #$0F, #$00, temp ;; game object 15
	;; X coord, Y coord, Object #, Action State
++
In this example we are creating 2 game objects, #14 and #15 (the last 2 under your game objects, but you can use whatever game object/monster you want, as long as it isn't a player). Those objects will spawn at the coordinates you assign for it's X and Y (this will take a lot of trial and error to find the right spot), and once both are created the game counts 2 monsters on screen and skips creating more. Make sure those objects are flagged as Monsters so they will be counted (otherwise it will keep creating endless objects) You can also use regular monsters if you have used all of your regular game objects (monsters start at #10 and just count down to find their object # i.e. your first monster is #$10, the second is #$11, etc.). I've tried this with 1 and 2 game objects and it works fine. You can attempt to add more but I can't guarantee their effectiveness.

If you want a game selection on your title screen as well, this works fine with that. Just follow Dale Coop's selection script first: http://www.nesmakers.com/viewtopic.php?f=40&t=2707.

Okay so now we can make objects here, what can we do with them? You can do anything that a monster can really do action-wise. In the example above I have object #15 running back and forth, and game object #14 that goes to warp at the end of a timer, starting an intro cutscene that resets to the title screen at the end. Just using the standard "Go to Warp" will warp to overworld screen 0,0, so I recommend just using that screen for this.

A few things to note, a title screen does not entirely behave like a normal screen. Set your objects to ignore gravity to make sure they behave, which is necessary since we can't really mark tiles as solid anyway, and "edge of screen" does not seem to apply (at least it didn't in my game). The monster counting may not be necessary, but I found that if you leave the title screen and come back (either by warp or reset) the objects would misbehave and create new ones so I suggest leaving it in.

That's it! It's pretty simple, so get creative with it!
 

dale_coop

Moderator
Staff member
Good tutorial, thanks for sharing.

Personally, I would not have had that code in that script... the PreDraw is a script that is executed every frame.
i think it would be easier to add that code in the HandleScreenLoads.asm (executed only once, when loading the screen). So you would not need to count the objects, just create them if on start screen.
 

crazygrouptrio

Active member
dale_coop said:
Good tutorial, thanks for sharing.

Personally, I would not have had that code in that script... the PreDraw is a script that is executed every frame.
i think it would be easier to add that code in the HandleScreenLoads.asm (executed only once, when loading the screen). So you would not need to count the objects, just create them if on start screen.

I actually tried that first and couldn't. It might be because Shera was started in 4.1 and things were set up differently? Good advice for others of course, but at least in my case this works fine and doesn't hurt anything else. ;)
 

dale_coop

Moderator
Staff member
It would work in handleScreenLoads.
In all my projects, I code my objects for special screens (and all my other stuffs, after loaded), there.
I do that since the the older versions... and still doing that in my recent projects.

Just place all the code you need to be done after your screen loaded, around the end of the script (around line 737).
 

crazygrouptrio

Active member
dale_coop said:
It would work in handleScreenLoads.
In all my projects, I code my objects for special screens (and all my other stuffs, after loaded), there.
I do that since the the older versions... and still doing that in my recent projects.

Just place all the code you need to be done after your screen loaded, around the end of the script (around line 737).

Ha. So it does. I probably stuck it somewhere else and thats why it didn't work. This is why I don't like making tutorials. I can get things to work but never in the best way :lol: Thanks I'll update the tutorial to reflect this.
 

dale_coop

Moderator
Staff member
No, no, it's awesome to have people sharing tutorials! Yours is totally working.
Like Joe said, there is no one way of doing things when coding for NES. There a lot of different ways!
 
Top Bottom