Language…
3 users online: George, ShadowMistressYuko, Zavok - Guests: 76 - Bots: 94
Users: 67,694 (2,003 active)
Latest user: Sable Mage

Simple Walljump by xhsdf

File Name: Simple Walljump
Submitted: by xhsdf
Authors: xhsdf
Act As: 130
Includes GFX: No
Description: Simple wall jump block used in Super Foo World. Some people asked for this.



- Block will activate even without the player holding against the wall

- will launch the player quite far if dpad is neutraled

- conserves type of jump (normal, spin, duck)
Tags: wall jump, walljump
Screenshots:
It works, but there are some issues with the block before it can get approved.

First
Code
	;~ check if jump buttons are pressed
	LDA $16
	BMI .jumpWhere
	LDA $18
	BMI .jumpWhere
	BRA return

	RTL
You don't have to "BRA" to an "RTL", since there's one right under it. Just remove "BRA return".

Second
Code
.jumpWhere
	LDA $93
	BEQ .jumpLeft
	BRA .jumpRight
	RTL

.jumpLeft:
	JSL .jump
	LDA #$D0
	STA $7B
	RTL

.jumpRight:
	JSL .jump
	LDA #$30
	STA $7B
	RTL
You don't have to branch to ".jumpRight", you could rearrange the code in such a way, that ".jumpRight" is under "BEQ .jumpLeft".. you should also use "JSR" instead of "JSL" here. The "RTL" at the end of ".jump" should be an "RTS" also.
Like so:
Code
.jumpWhere
	LDA $93
	BEQ .jumpLeft

	JSR .jump
	LDA #$30
	STA $7B
	RTL

.jumpLeft:
	JSR .jump
	LDA #$D0
	STA $7B
	RTL
...if the check for ".jumpLeft" fails, the code for ".jumpRight" will run, you don't have to branch to it.

Third
Code
	LDA #$02
	STA $1DF9
Minor, and not a rejection reason, but it would be nice if you made this an SA-1 hybrid, by putting "|!addr" at the end of every 4-digit address, in this case "$1DF9".. (DO NOTE! This isn't always the case, but in most situations it works.)
Like so:
Code
	LDA #$02
	STA $1DF9|!addr
Again, not a rejection reason, but it would also be nice if you made these defines, so it's easy for others to configure.
At the start of the file:
Code
!sound = $02
!soundbank = $1DF9|!addr
and that code part should be
Code
	LDA #!sound
	STA !soundbank
This would make it easy for people to change what sound the blocks play.

And lastly
Code
	JSL $01AB99
Yep. This DisplayContactGfx routine is normally called by sprites, and it uses the value in X to determine if the current sprite is offscreen or not. But since you're using this in a block, and you don't set X anywhere in the code, using this routine is not a good idea. The routine will either read garbage or some random sprite's data. You'd either have to JSL past the first check of the routine ("JSL $01AB9E" instead), or replicate the needed part of the code yourself. I recomment just JSL-ing "$01AB9E". And while you're at it, add a "|!bank" at the end of the address to give fastrom users a tiny boost.
Code
	JSL $01AB9E|!bank