Language…
5 users online: Astrakitu, cletus_deletus,  Donut, GRIMMKIN, RPG Hacker - Guests: 247 - Bots: 380
Users: 64,795 (2,376 active)
Latest user: mathew

Tic tac blocks code by Superwan

File Name: Tic tac blocks code
Submitted: by Superwan
Authors: Superwan
Type: Level
Includes GFX: No
Includes Hijack: No
Featured: No
Description: Just a code that recreate the effect of tic-tac blocs in SM3DWorld : it sounds like a tempo and switch the ON/OFF so you need to use ON/OFF blocks

Example : https://www.youtube.com/watch?v=c8FyvJC8ZH4&list=PLvacKDH5GG7emdc6M7ZXfCJXACldLfb5Z&index=4&t=0s
Screenshots:
The concept for this is good, but its execution could be cleaner.

- For starters, this was confusing me to what it's supposed to do (I have never played SM3DW) until I saw this was supposed to be used with some ON/OFF blocks. Yes, the description said something among those lines, but still there's no excuse to include the blocks (or link them should they exist already).
- I think including an option for this to use its own switch instead of hardcoding it to the ON/OFF status, so if people still want to use the ON/OFF block's normal functions alongside this tic tac block code.

- The main offender is the code, which is really unoptimized and does some things it shouldn't.
1.- Don't do STZ $14. This will mess up the animations. Since it defaults to .25 seconds or 0x1C frames, and then it resets it after reaching this value, any resource that depends on the frame counter having higher values will break.
2.- You should leave your FreeRAM as a define so the user can change it.
3.- This code could be cleanlier:
Code
load:
	LDX #$00
	STZ $13C0
	RTL

...what's the point of this? Yes, it should be 00, but there's no reason to clear it out because nothing else even writes to it.
Code
	LDX $14			;
	CPX #$1C		;\
	BEQ Tempo		;/

Again, to avoid doing STZ $14, just check the frame counter like this:
Code
LDA $14
AND #$1C
CMP #$1C
BEQ Tempo


Code
	Switch:			;
	LDY #$28		; Sound
	STY $1DFC		;
	LDY #$0F		; Shaking ground
	STY $1887		;
	LDY $14AF		; Etat du ON/OFF
	CPY #$00		;|
	BEQ OffSwitch	;|
	LDY #$00		;|
	STY $14AF		;|
	JMP OnSwitch	;|
	OffSwitch:		;|
	LDY #$01		;|
	STY $14AF		;|
	OnSwitch:		;|
	JMP EndSound	;/

1.- Make the sound a define so the user can change it easier.
2.- You can just do this to invert the ON/OFF status:
Code
LDA $14AF
EOR #$01
STA $14AF

3.- Unless you're getting branch out of bounds errors, use BRA instead of JMP.

Code
	LDA $0DD4		;
	CMP #$04		;
	BCC Sound
	CMP #$04		;
	BEQ Switch

|
v
Code
LDA $0DD4
CMP #$04
BEQ Switch
BCC Sound


There's no need to babysit the value of A by using other registers. Just use A normally and load $0DD4 before branching to EndSound.

Change that stuff up and I might accept it. (if you do end up adding a custom switch, submit this to the blocks section instead!)

Keep practicing, and eventually you'll get the hang of ASM much easier. Good luck in your future resources!