| What's wrong with my code? |
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - What's wrong with my code? |
|
Pages: 1  |
|
|
|
| Posted on 2012-02-10 03:26:35 PM |
Link | Quote |
|
Okay, I'm doing a powerup that makes Mario explode like a Bob-Omb. The problem is, when I test it, everything is correct, MINUS the fact Mario DOESN't explode. How do I fix the piece of code below to make Mario explode?
(The use of RAM $1497 is intentional)
CodeLDA $1497
BNE Return2
LDA #$15
STA $1887 ; shake the ground
LDA #$0D ;/
STA $9E,x ;\ Sprite = Bob-omb.
LDA #$08 ;/
STA $14C8,x ;\ Set status for new sprite.
JSL $07F7D2
LDA #$01 ;\ .. and flag explosion status.
STA $1534,x ;/
LDA #$40 ;\ Time for explosion.
STA $1540,x
JSL $028086
LDA #$09 ;\
STA $1DFC ;/ Sound effect.
LDA #$1B
STA $167A,x
LDA #$80
STA $1497
Return2:
RTS
|
|
| Posted on 2012-02-10 03:47:07 PM |
Link | Quote |
|
It doesn't seem like you're setting the position of the spawned explosion anywhere in that code, so it's probably ending up somewhere way offscreen. Also, I assume you have code to find an empty sprite slot and put it into the X register right before the piece of code you posted? Otherwise, you're going to have to add that as well.
Or is this whole thing a sprite that follows on top of Mario's position? In that case, disregard everything I just said.
|
|
| Posted on 2012-02-10 04:04:10 PM |
Link | Quote |
|
|
No, it's a powerup. So... all I have to do is set the explosion position to Mario's position or am I wrong?
|
|
| Posted on 2012-02-10 04:06:48 PM |
Link | Quote |
|
|
If the code you posted is already in a sprite and you don't need Mario to be able to explode more than once (since you're overwriting the current sprite with the explosion), then sure. Just note that this will hurt Mario when triggered unless you turn him invincible for the duration of the explosion.
|
|
| Posted on 2012-02-10 04:15:31 PM |
Link | Quote |
|
Nope. It still doesn't work. When I test it, mario explodes, but some weird tiles appear near the status bar...
EDIT: Problem solved. This can be closed now. Thanks, yoshicookiezeus.
|
| Last edited on 2012-02-10 04:30:55 PM by Fierce Deity Manuz OW Hacker. |
|
| Posted on 2012-02-10 04:31:27 PM |
Link | Quote |
|
|
What kind of tiles? Sprite tiles or layer 3 tiles? The latter would probably just be a misplaced store to one of the status bar addresses, but the former sounds like more like something has gone wrong with the OAM.
|
|
| Posted on 2012-02-10 06:25:43 PM |
Link | Quote |
|
Don't worry, yoshicookiezeus, I discovered that the weird tiles were actually the explosion; I fixed the powerup and made two hex edits so the explosion tiles now use the unused 5-up tile.
As I said before, this can be closed. Thank you.
|
|
|
Pages: 1  |
|
|
|
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - What's wrong with my code? |