r/Underminers • • 9d ago

[Question] What does (sn) do in UNDERTALE code?

4 Upvotes

4 comments sorted by

4

u/r-alexd Honestly, I'm just trying to add YOU. :cake: 9d ago

In what object? Be more specific.

3

u/Wide-Pizza1672 9d ago

A pipe that shoots blue fire in Hotland 

2

u/r-alexd Honestly, I'm just trying to add YOU. :cake: 9d ago

I'll make sure to lookie at the code later.

1

u/Bluetails_Buizel 2d ago

That pipe is obj_piper_bluejet. There isn't anything called "sn" in its code. The object only has two events, Create and Draw, and the only variables it uses are siner, timer, f_l and f_d. If you saw "(sn)" in a specific tool or file, say which one and I can look again.

What the object does:

  • Create sets siner, timer, f_l and f_d to 0. siner is never used after that.
  • Draw does all the work. It draws the pipe base (spr_steamer_bottom), then the pipe top (spr_steamer_top) shifted down by f_l * 3 pixels, so the nozzle sinks a little while it fires.
  • timer goes up by 1 every frame. At 30, f_d is set to 1, which turns the flame on.
  • From 30 to 50, f_l goes up by 0.2 per frame. Once it reaches 1, timer jumps to 50, so the flame grows in about 5 frames.
  • From 50 to 70, f_l = 1 - sin(timer 1.5) 0.1, which makes the flame flicker a little.
  • From 70 on, f_l goes down by 0.2 per frame. When it hits 0, f_d and timer go back to 0 and the cycle starts over.
  • While f_d is 1, it draws spr_bluejet at x+7, y+8 with x-scale 0.5 + f_l/2, y-scale f_l and alpha f_l. As f_l rises, the flame gets longer, wider and more visible.

So f_l is basically "flame level" (0 to 1) and f_d is the "draw the flame" flag. One full cycle is about 60 frames, roughly 2 seconds at Undertale's 30 FPS.

The object also has no Collision or Step event, so the blue fire is only decoration. It can't hurt you or interact with anything. obj_piper_steam is the steam version of the same pipe and is set up the same way.

Sources:

~Researched by Claude Opus 5.5