What the hell!? I SWEAR I posted here half an hour ago... Dammit, I must've hit Preview instead of Submit. =__=
Well, SNN, it just so happens that I can help you. See the LDA #$00 right before the last JSL at the veeeeery end of your code? Make that an LDA #$01. That value in particular is supposed to say how many 16x16 tiles you're drawing per frame, minus 1. (So 1 tile would be 00, 2 tiles is 01, 4 tiles is 03, etc.) We're drawing 2 tiles, not 1, so that should say #$01, not #$00. If that doesn't work, well, damn, I dunno what's causing it...
Okay, my turn. Here's my latest custom block... She's a sassy young lass I like to call the Ice Slope, and she needs taming.
Originally posted by Ice SlopeLDA #$80 ; turn on slippery flag
STA $86
LDA #$04 ; hold the Down Button and disable other buttons
STA $15
RTS ; finish the code
So what does this do?
The first part sets the Slippery Level Flag to "ON". The reason I need this is because I have icey ground and normal ground in the same level; the icey ground changes the Slippery flag to ON when touched, and the normal ground changes it to Off. It takes some setting up, but now I can have slippery and normal floors in the same level.
Since this block is ice, it needs to turn it to On when touched.
The second part takes the Controller data and changes it to "holding the Down button". Now keep in mind that this block has "Acts Like" set to 1AA and 1AF, which are left and right slopes respectively. So when the Down button is held, Mario won't duck... he'll slide. So this block makes Mario slide as long as he's standing on it... resulting in an icey slope too slippery to walk on without Mario sliding out of control! Yarr!
So, if this block works so well, what's the problem? Well...
When you press the Jump button when standing on this, Mario still jumps. And I don't want him to do that. What makes things hard is that I have no idea what code to write to disable the buttons while this block is being touched. And THAT... is what I need help with.
If possible, I want to disable A, B, X and Y while Mario's touching this block. That way, Mario can't jump, spin-jump, run or shoot while sliding. Now according to some documents I found on another site, Ram Address $15, which handles various button presses on the controller, is binary-operated... Bitwise 40 means either X or Y is being pressed, and Bitwise 80 means either A or B is pressed. This means Bitwise C0 is a combination of X or Y plus A or B. I need to get it so when 40, 80 or C0 is written to $15 at any time while Mario is touching the block, it counts as 00, but I STILL have to make sure $15 stays at a consistant value of 04 (for the Down button being held).
What do I do?
Edit: HA. I got it to work. Once again I was thinking too hard. Wanna know what I did? Here.
Originally posted by "Improved Ice Slope"
LDA #$80 ; turn on slippery flag
STA $86
LDA #$04 ; hold the Down Button and disable other buttons
STA $15
LDA $14 ; check the frame number
AND #$03
BNE NoSound
LDA #$04 ; play a slipping sound effect every 4th frame
STA $1DFA
NoSound:
LDA $7D ; check to see if Y speed is upward
BMI MovingUp
RTS ; finish the code if it's not
MovingUp:
STZ $7D ; otherwise, stop Mario from moving upward
RTS
See? I added quite a bit of new bits. First we have the slippery flag, as before... Then we have the Down Button code, as before... The third piece, which is new, plays a slipping sound effect every 4 animation frames. I had to do that, hehe... The fourth piece, also new, each frame checks to see if Mario's Y speed is upwards even the slightest bit. If it's not, nothing extra happens; slipping continues as normal. If it IS, it sets Mario's Y speed to zero, preventing the jump from ever happening.
The effect I get in the game is more than satisfactory. While it doesn't prevent Mario from jumping in the first place, it does manage to make his jumps absolutely worthless; he'll get one pixel off the ground and land again. It still plays the jump sound effect, which is annoying, but I think I can actually fix that too by adding the "play sound effect" code to the end of STZ $7D also. I'll test it out now.
Edit2: Okay, finally I perfected it. I noticed something seriously wrong earlier... Sometimes Mario could become trapped in a ducking state at the foot of the slope. This fixes that.
Originally posted by Finalized Ice Slope LDA #$80 ; turn on slippery flag
STA $86
LDA #$04 ; hold the Down Button and disable other buttons
STA $15
LDA $14 ; check the frame number
AND #$03
BNE NoSound
LDA #$04 ; play a slipping sound effect every 4th frame
STA $1DFA
NoSound:
LDA $7D ; check to see if Y speed is upward
BMI MovingUp
RTS ; do nothing if it's not
MovingUp:
LDA $73 ; if Mario's at the bottom of the slope, allow him to jump
BEQ NotDucking
RTS
NotDucking:
STZ $7D ; otherwise, make jumps useless
RTS
The last bit of code I added won't nerf Mario's jump if he's in a ducking state. Since he's NOT in a ducking state while sliding-- just while at the foot of the slope, his jumps will be nerf'd while actually sliding on the slope, but not if he's at the foot of the slope. He'll still be ducking, though, but that's not a MAJOR problem.
Man! This code fits together like a perfect jigsaw puzzle!!
DD
Whaddya think? Should I submit this to the database or what?
It's me!!
High on life is the best high.