23 users online:  AmperSam, blaze800000, DerJay93, drkrdnk, El Cuh Fermin, eltiolavara9, h.carrell,  Hooded Edge, Hwailaluta,  idol, IkeSMB, Jgb007, Kamikaizo, Link13, Lmao, Mayosunshine, Mega, NewPointless,  RussianMan, sio-kedelic, Sugar, Zatara, Zavok - Guests: 80 - Bots: 219
Users: 65,847 (2,176 active)
Latest user: Stargazer

Password System

UberASM Repository → Password System

Submission Details

Name: Password System
Author: Nowieso
Version History: View
Type: Level
Includes GFX: No
Includes Hijack: No
Featured: No
Description: With this code, you can easily create a unique password system for your level. Define inputs that have to be done in the correct order and one of these things will happen:

-Kill the player
-Hurt the player
-Give the player 1-UP(s)
-Give the player a Power-UP
-Give the player some coins
-Give the player Star-Power
-End the level (normal exit)
-End the level (secret exit), triggers the keyhole animation
-Spawn a sprite
-Change ON/OFF Switch state
-Activate P-Switch
-Teleport to current screen exit
-Teleport the player to the overworld, no event triggered
-Teleport the player to a different overworld position

Every option is very customizable, so make sure to change the defines in the asm file.

V1.1 fixes
- You can now define an unlimited amount of inputs and not only 10
- HUGE code optimization making the code about 200 lines shorter
- P-Switch music now correctly plays
- Sprites now turn into silver coins when using the silver P-Switch
Tags: input lorom on off p-switch password sa-1 sprite spawn teleport
Comments: 8 (jump to comments)
5.0 (1 rating)
No rating
Download 3.55 KiB | 418 downloads


View all

Comments (8)

Remalis Link
Seems like changing the address loaded on lines 139 and 143 from $16 to $15 fixes the A button issue.
 Anorakun Link
Can confirm, the "A" input does not work at all. This code needs a bugfix. Also why "A" or "B", shouldn't they be separated inputs? Same with X and Y. Why not separate inputs? This hurts the usability of this ASM a bit. Next version would be nice to fix that.
megaBC333 Link
for some reason the "A" inputs don't work for me. All other inputs work just fine but nothing happens if I press "A". Using choice 12 if that matters
 Ayami Link
this will be VERY useful for me in a future, good code!
 Kevin Link
Tested with: LM 3.10, UberASMTool 1.4, SA-1 1.32, pixi 1.2.12, Snes9x 1.60.
Indeed a nice update, glad you fixed the couple of issues of the previous version and I saw a lot of improvements in the code. Also very nice that now you can define codes of arbitrary length.
As westslasher said you could also decrease the code for spawning normal/custom sprites since almost all of it is shared, but since doing this doesn't affect the insert size it doesn't really matter.
westslasher2 Link
Seems like a very nice update, you can also shorten the code that you are using for custom and normal sprite spawning.

if !spriteType == 0
;Normal Sprite
LDA #!normalSpriteNumber
STA !9E,y
LDA #!customSpriteNumber
;Add-in extra-bytes here.
;x/y offsets go here.
simon.caio From older version: Password System Link
Great! thank you!
 Kevin From older version: Password System Link
Tested with: LM 3.04, UberASMTool 1.4, SA-1 1.32, Snes9x 1.6. The code works well and it has a lot of interesting options, so accepted.
I found a couple of small issues that would be nice to fix in an update: when enabling the PSwitch option, the song doesn't change. Also, for the silver PSwitch, you need to add a "JSL $02B9BD" to turn all the on-screen sprites to silver coins.

Besides that, it would be nice to make an update to optimize the code (it's not a major issue, but it could also be a useful exercise for you :P). Right now you've encoded the different inputs with separate defines, so there's no room for expansion and there's a lot of duplicate code to check all the different inputs. A much compact (and faster, probably) way to do this could be to encode the inputs in a table (that could be expanded beyond 10 entries), so you wouldn't need to check !freeRAM for each possible value and jump to the different (but basically identical) subsections: you could just use the same code, pulling the correct value from the table using !freeRAM as the index.