Language…
7 users online: Batata Douce, DanMario24YT, kurtistrydiz, mathew, MegacesarCG, monkey03297, TheOrangeToad - Guests: 286 - Bots: 347
Users: 64,795 (2,378 active)
Latest user: mathew

Multiples coin sounds

I'm new to ASM and i'm currently doing a block that give up to 100 coins.

The part about the coins is working, but i'm trying to make the sound effect for coin (#$01 in $1dfc) play multiple time.
I try some things, but whatever i do, it always play one time only

Any tips?

Thanks


Well, it depends on what you're trying to do.

If Mario is hitting the block from below and then receiving 100 coins, you'll only be able to play the sound effect once with what SMW gives you. The reason is because blocks only run their code while Mario or sprites are touching them, so you wouldn't be able to play the coin sound during frames when they aren't. The only way to circumvent that is to add code elsewhere to do so (often, UberASM is used to do so; you could just check $13CC and, if it's non-zero, play the sound).

However, that presents another possible issue with what you're trying to do. If you do that (or if your block works by having Mario just stand on top of the block the whole time), most likely you'll still just have the sound effect play once. This is because sound effects will only play when the sound number actually changes between two frames; so if you do this over the course of 4 frames:

Code
Wait -> Play -> Play -> Play

You'll only hear the sound effect when the "Wait" switches to "Play". So instead, you should alternate them like this:

Code
Wait -> Play -> Wait -> Play

To do so in ASM, people typically use the frame counter $14:

Code
	LDA $13CC
	BEQ .ret
	LDA $14
	AND #$01	; how often to play; this is every other frame. #$03 (every 4th frame) and #$07 (every 8th) are also common
	BNE .ret
	LDA #$01
	STA $1DFC
    .ret
	RTL


Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thanks a lot!!!

Now it's gonna work. I never used any frame counter before so i didn't tought about using one, but it was a great idea.

My block give mario up to 100 when he passes through it (act like a cloud) and i'm gonna use it alongside one that take out all your current coins... it's gonna be a luck base mini game (kind of like the three block game in the original game).