dale_coop said:
Not sure where you could "PlaySound #sfx_blank"... you would like to be played when no more collision with the rail tile (but it means the rail tile will not be executed, in that case).
You could try putting it around line 20, just before the line:
but even here, I am not sure.
Stoping sounds is not a trivial thing in nesmaker >_<
Or maybe if you don't make a loop sound... but just one 1 or 2 loops... maybe the sound will stop itself automatically?
Hello Dale! I had a chance to do some tests this weekend. It turns out the looping sfx issue is actually pretty simple. I created a short sound effect in famitracker (4 rows) and one more row to add a blank instrument to finish as I always do.
Upon testing I discovered that the sound effect will play continuosly as long as I was pressing the input into the "rail". You can see here in the 1st half of this test video that the sfx_grind is working as it should:
https://youtu.be/DCh1eu5_YwQ
However, the second half of the video shows the upper rails and the sound effect does not play. I inserted the Playsound only at the end of the script here, Is there a better way to do this?
Code:
;; checking center left collision point
LDA collisionPoint4
BNE RailsLeftRight ;; there is a left collision
;; checking center right collision point
LDA collisionPoint5
BNE RailsLeftRight ;; there is a right collision
;; checking center right collision point
LDA collisionPoint0
CLC
ADC collisionPoint1
BNE doRailSlidingDown ;; there is a top collision
;; checking center right collision point
LDA collisionPoint2
CLC
ADC collisionPoint3
BNE doRailSlidingUp ;; there is a bottom collision
RailsTopBottom:
;; block vertical movement:
LDA yPrev
STA Object_y_hi,x
STA yHold_hi
JMP endRails
RailsLeftRight:
;; solid from sides:
LDA #TILE_SOLID
STA tile_solidity
;; now checking the game pad (if pressing Up)
;; to slide the player vertically
LDA gamepad
AND #%00010000
BNE doRailSlidingDown
doRailSlidingDown:
;; a small sliding down:
LDA yPrev
CLC
ADC #$01
STA Object_y_hi,x
STA yHold_hi
JMP endRails
doRailSlidingUp:
;; a small sliding up:
LDA yPrev
SEC
SBC #$01
STA Object_y_hi,x
STA yHold_hi
PlaySound #sfx_grind
endRails:
I've tried inserting PlaySound #sfx_grind in between each block of code but cannot get the sfx to trigger on the northern top rail. I am kind of stumped, but the actual sfx loop we discussed is working great on the bottom rail! Almost there, I presume if sfx were linked to actions without endings like jumping or shooting, the sfx would loop with buttons being held etc depending on the application. AT LEAST it is good know that looping SFX can be set up normally in famitracker! That is a good start, once I figure this concept out fully I'll make a post in the music section explaining how looping sfx can be easily set up.
Now, besides the SFX on the top side, the rails are functioning pretty much as needed. I decided to do some experiments and subbed in the rail script with the default solid behavior tiles script. Unfortunately the results were not what I had hoped for, the player behaved like a wet bar of soap around obstacles, pressing on, or in between any solid obstacle would result in the player being squeezed quickly out or around the cracks. It's kind of comical, as well, it causes collision issues with my NPCS, if you watch till the end of the video you'll see the solid tiles holding the npcs cause them to wander off and leave the sandwiches.. that made me laugh really hard when I saw it, I am really starting to appreciate unintended programming glitches as great comedy
https://youtu.be/YmuicuWXyps
So, from here I suppose I can implement the rails into my game as they are and leave the solid obstacles on the road as the default sticky solid behavior script. Or at least look for a happy medium in the solid behavior section in the meantime.
I wish I could simply decrease the resistance of the default solid object script slightly so it doesn't feel as punishing at the scroll speed i've chosen. Many shmups would simply use instant death tiles to make up the backgrounds and this solid tile wouldn't be a problem. So this particular issue may be unique to a game type such as mine (obstacle based racing shooter?!?! OBRShmup?!? lol) .
Any advice on that SFX problem would be greatly appreciated, I'm stumped!