Language…
16 users online: anonimzwx, Aurel509, buggy789, cohimbra, Dennsen86,  Doctor No, Fozymandias, Gamet2004, Green, Green Jerry, jirok1, Metal-Yoshi94, Raychu2021, sinseiga, Sokobansolver, twicepipes - Guests: 268 - Bots: 324
Users: 64,795 (2,375 active)
Latest user: mathew

Generating a sprite from the L/R Hook patch

Is there a way to do this without crashing the game? I tried adapting some code from a shooter and it just turns the screen black...

EDIT: wait what? how is this my first post?
Yes, it's possible.

Then some example code would be nice ^^;
Originally posted by Ixtab
Yes, it's possible.


Don't make useless posts if you're not going to attempt to help.

JVyrn: I have some code (made by Ersanio I believe) which seems to generate a sprite just fine upon the death of another one. I can't guarantee it will work with the patch, but you can give it a shot anyway.

Code
GENERATION		JSL $02A9DE		; \ get an index to an unused sprite slot, return if all slots full
			BMI RETURN		; / after: Y has index of sprite being generated

			LDA #$2D		; \ sound effect
			STA $1DFC		; /

			LDA #$08		; \ set sprite status for new sprite
			STA $14C8,y		; /
			LDA #$1D		; \ set sprite number for new sprite
			STA $009E,y		; /

			LDA $E4,x		; \ set x position for new sprite
			STA $00E4,y		;  |
			LDA $14E0,x		;  |Xpos is the same as the muncher's
			STA $14E0,y		; /

			LDA $D8,x		; \ set y position for new sprite
			SEC			;  |
			SBC #$0F		;  |
			STA $00D8,y		;  |16 pixels above the munchers
			LDA $14D4,x		;  |
			SBC #$00		;  |
			STA $14D4,y		; /

			PHX                     ; \ before: X must have index of sprite being generated
			TYX                     ;  | routine clears *all* old sprite values...
			JSL $07F7D2             ;  | ...and loads in new values for the 6 main sprite tables
			PLX                     ; /

RETURN              RTS                     ; return