SMBX MOVING LAYER CALCULATIONS

Mario Teaches Math!

  • pyrodoom
  • 04/19/2018 05:47 AM
  • 2656 views
INTRODUCTION
Hello, my name is Pyrodoom, and for my first tutorial on this site I'm going to rant about a feature in SMBX that is kinda awkward.
Like most features in SMBX.
Ha.
Most people who use SMBX, veterans specifically, may already know about this given I rarely see people who mess up their moving events, but given I once had trouble and needed this information in the past, someone else may need it.

All credit to NaviGator and PixelPest on the SMBX forums for the equations, I'm merely making this tutorial since it's handy to have here as well and because I'm a nerd and wanted to explain the numbers.

DETAILS OF THE EVENTS EDITOR


When making your moving layers, you'll go in the event menu and find a section titled "Layer Movement" with three boxes below it for Horizontal Speed, Vertical Speed, and a drop down box to select the layer; a section titled "Trigger Event" with a drop down menu below it for selecting the event; a section titled "Delay" with a slider below it for the number of seconds; and finally a section simply titled "Events" with a place to enter a name for your event(only for organization - it doesn't matter what you call it as long as you, the creator, or if you're working with someibe else then your partner as well, can understand it) and a box to select the event you want to edit. That is all that will be important to you for this. Sometimes Auto-Start is involved, though only for if the platform is moving constantly.

EQUATIONS
With all that understood, these are the two important equations:

32*(Number of Blocks)/(Delay)/(2500/39)=(Desired Speed)
32*(Number of Blocks)/(Desired Speed)/(2500/39)=(Delay)


Let's start breaking it down:
So, the first part, 32*(Number of Blocks) represents the number of pixels for the moving layer to move. Since a "block" or tile(the space a single normal block will take) is 32x32 pixels large, 32 is the conversion rate if length in SMBX from blocks to pixels.
The second part is what we are trying to find in the other corresponding equation - you need to know the "Delay" or Desired Time for the movement to replace to find out the speed and you need to know the "Desired Speed" to find "Delay". Delay corresponds with the Delay section and handles how long a layer will move before it stops or changes direction and Desired Speed corresponds with the Layer Movement section and whichever direction the layer moves in. Negative(-) speeds make the layer move up and/or left and Positive(in math represented as a + but is unneeded here) speeds make the layer move down and/or right. For diagonal movement, the equations for speed would need to be done twice corresponding to the number of blocks to move vertically and horizontally. Finding time isn't as accurate as finding speed since in SMBX Delay can only go into the tenths place whereas speed can at least be accurate to the billionths place I'm sure.
The last number, (2500/39) or 64.1025641 is related to the FPS that SMBX runs at - I believe its the average highest FPS it can run but I'm not certsin. All I know is that its more accurate than just using 65 as the value there and helps with desyncing problems that may happen when only using 65.
Finally, the last number is the number we are trying to get, which as we covered in the second paragraph of this part is the opposute variable to the one we used to helping it - if you know speed, you find delay and give versa.

CONCLUSION
You get all that? Good.
So with these two equations, you should be able to find those values for your moving layers much easier!
Thanks for reading my little nerd ramble and I hope it helped you.

SOURCES
Moving Layer Calculations
The Official Guide to Layers and Events in SMBX for the image