Language…
8 users online: ASSATAKKU, Bullymario, Dan2point5, h.carrell, RenkoV2, ryuuune, ShadowBoxer_Sandshrew, Tulip Time Scholarship Games - Guests: 86 - Bots: 215
Users: 66,534 (2,385 active)
Latest user: amyysucks

Pressure Switch + Gate

SMW Sprites → Pressure Switch + Gate

This file is obsolete. The latest version is Pressure Switch + Gate. For other versions, check the version history.

Submission Details

Name: Pressure Switch + Gate
Author: JamesD28
Added:
Version History: View
Tool: PIXI
Type: Standard
Dynamic: No
Disassembly: No
Includes GFX: Yes
Description: This is a pair of sprites: A Switch that can be pressed down by standing on it, and a Gate, that will open when a linked Switch is pressed. You can link Switches and Gates together by giving them the same value in extra byte 1 (allowing you to have one Switch open several Gates, or several Switches open one Gate, or any combination). You can also set timers for how long the Gates stay open (including forever), the manner in which they close, the Gate size, and several other Gate and Switch behaviours.

Usage notes:
- The Gate must be inserted as the very next number after the Switch in PIXI's list.
- The Gates do NOT interact with sprites, nor do the Switches.
- Tile priority should be enabled on tiles that the Gates can overlap with when opening, to ensure the Gate goes behind.
- The "Clipping.asm" file should be inserted in PIXI's "routines" folder.
- The Switch and Gate each take a sprite slot. Considering SA-1 might be a good idea if you plan to make a level based around these sprites.
Tags: gates lorom sa-1 switch
Comments: 8 (jump to comments)
Rating:
0.0 (0 ratings)
No rating
Download 25.52 KiB | 584 downloads

Screenshots

View all

Comments (8)

gabiel_poli Link
This is my 1st place favourite sprite ever!
its_4life Link
Reminds me of the gates from Sandopolis Zone Act 2 in Sonic 3 & Knuckles
HammerBrother Link
Originally posted by KevinM
- The switch tends to "suck you in" as soon as you touch it, no matter if you're already on a solid block/sprite. This can lead to easily dying if a solid block is placed right by the side of the red switch, so try not to do that.


One easy fix is simply checking if the player is on the ground using $77 (assuming the sprite code runs BEFORE clearing $77), then disconnect the player off the switch. I think SMW's platforms does this or at the very least have the hitbox that would snap the player onto the platform be small enough so that even a few pixels off the platform causes the player to disconnect (around 4 pixels extending from the top of the platform?).

Edit, most of SMW solid sprites like platforms and solid block sprites like the message block and light switch checks $77:


The closest sprite to this that don't have this suction bug is the stationary reusable switch.

2023-01-27 EDIT: tested it out trying to fix the glitch via adding a ground check and it didn't work (every other frame the player on the switch will oscollate between falling and standing).

In fact, looking at its code, unlike the stationary reusable switch or any platform sprites that move down and through layer 1, vanilla or sprite (example, tested), this sprite actually DOES NOT move downwards, other than the graphic OAM and the position to set the player to so he goes down with the switch cap. The "snap-player hitbox for the switch's cap actually stays in place even when pressed, and when the player is in this stationary hitbox, and not moving upwards, will set his Y position upwards or downwards, to position him on top of the switch cap, regardless if the player isn't actually touching the cap.

I tested this using bsnes+ debugger, and after the player completely presses the switch, I set a breakpoint here (underlined):
Code
LDA !14D4,x
XBA
LDA !D8,x
REP #$21
ADC $00
SEC
SBC YoshiOffsets,y
STA $96

After this code executed, I then open the memory editor, and modified RAM $96-$97 (player Y position), to be a value of 15 ($0F, almost a full 16x16 block) pixels upwards from his on-switch position. I then hit "run" and immediately the breakpoint fires again on the next frame, indicating that the hitbox does indeed extends from the pressed switch cap to the top of the unpressed switch position.

Vanilla SMW's platforms also suck the player through the ground but rather slightly and will disconnect the player from the platform. These platforms do have a hitbox that extends past the top of the platforms, but only by a few pixels. This is because for falling platforms, if it weren't for the hitbox extending past the top, the player would've immediately disconnect from the platform (platform moves downwards). The only exception to this is when the platform falls down fast enough.
 Kevin Link
Tested with: Lunar Magic 3.21, PIXI 1.32, SA-1 1.32, Snes9x 1.60. The sprite works fine, so accepted. Some minor issues I've found:
- The button seems to be 1 pixel lower than it should. This is more noticeable when the red switch is directly on the ground, and it'll cause Mario to sink 1 pixel into the ground when pressed (no big deal though).
- The switch tends to "suck you in" as soon as you touch it, no matter if you're already on a solid block/sprite. This can lead to easily dying if a solid block is placed right by the side of the red switch, so try not to do that.
- If you jump on the bottom of a gate while it's moving down, you can easily clip through the sprite and die crushed.
- If you jump on a Springboard to the bottom of a gate, you'll clip through it and die crushed (even if it's not moving), due to the high vertical speed a spring gives you.
- The horizontal gates won't carry Mario while moving, so he'll "slide" while on them.
Overall a very nice sprite that would be certainly useful for puzzles or timed challenges.
JamesD28 Author Link
Originally posted by Anas
Very cool! Though instead of having to set the priority of Map16 tiles on, why not make the gate itself go behind the tiles, assuming the gate is a whole sprite?

This is how it was originally, but setting a lower priority also makes it go behind some layer 2 features (such as the distant clouds in the "star" BG).
Anas Link
Very cool! Though instead of having to set the priority of Map16 tiles on, why not make the gate itself go behind the tiles, assuming the gate is a whole sprite?
HammerBrother Link
Suggestions:

-I was thinking the switches can be 16x16 instead of 32x32, like these (including the base of those switches).

-I was thinking the gates to shorten so that the spot where it retracts to does not start extending on the opposite side.

-I was thinking the horizontal gates can also open to the right, and vertical opens downwards.
mason Link
wow, super cool!