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: |
First
Code
You don't have to "BRA" to an "RTL", since there's one right under it. Just remove "BRA return".;~ check if jump buttons are pressed LDA $16 BMI .jumpWhere LDA $18 BMI .jumpWhere BRA return RTL
Second
Code
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..jumpWhere LDA $93 BEQ .jumpLeft BRA .jumpRight RTL .jumpLeft: JSL .jump LDA #$D0 STA $7B RTL .jumpRight: JSL .jump LDA #$30 STA $7B RTL
Like so:
Code
...if the check for ".jumpLeft" fails, the code for ".jumpRight" will run, you don't have to branch to it..jumpWhere LDA $93 BEQ .jumpLeft JSR .jump LDA #$30 STA $7B RTL .jumpLeft: JSR .jump LDA #$D0 STA $7B RTL
Third
Code
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.)LDA #$02 STA $1DF9
Like so:
Code
Again, not a rejection reason, but it would also be nice if you made these defines, so it's easy for others to configure.LDA #$02 STA $1DF9|!addr
At the start of the file:
Code
and that code part should be!sound = $02 !soundbank = $1DF9|!addr
Code
This would make it easy for people to change what sound the blocks play.LDA #!sound STA !soundbank
And lastly
Code
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.JSL $01AB99
Code
JSL $01AB9E|!bank