LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

MarioMiner Library

Root / Submissions / [.]

MariominerCreated:
Download:43EX243D
Version:1.0Size:
I've used this library by myself in multiple programs, but here it is by itself: The MarioMiner Library. This library is packed with some cool features, including pointers, array constructors, sprite shaders, and many other useful gadgets. Documentation in the file will explain each feature to you in simple terms, so it should be simple to understand, though I'm always up for questions. Do you need word wrapping? This library does that. Resizing graphics? Slow, but it does that too. It even has a function that creates an on-screen keyboard on the bottom screen that you can click and use so you don't need to switch XSCREEN (since doing so wipes the sprites and bg screen). It does have an UPPER function, but not a coordinating LOWER function (I don't know why, but I never needed to use it.)

Instructions:

Load the library into a slot (as with all libraries)
LOAD "PRG1:MMLIBRARY.LIB",0
USE 1
Then you can read the documentation, which should answer most questions. However, the documentation doesn't include shading, so here's some info on that: To use sprite shading, you must make 2 sprites for every sprite you want to use it on in sequential order. First, set the angle you want the light source to be at using ANGD. It takes 2 values: the first one sets the angle of height of the light source compared to the sprite (should always be higher than 181 degrees). The second one sets the angle that the light source is to the sprite on the plane of the screen. This needs to be refreshed only when you are changing the angle of the light source. To get these angles, use GETANG to get the plane angle and GETHANG to get the height angle. When you want to cast your shadow, simply use SHADE (sprite number). This will turn the second sprite into a shadow and properly put it around the sprite. It's very fast and easy; 3 sprites will only take a millisecond to cast the shadow for all of them. Alright, any questions? I'd love to answer them.

Notes:

Don't use the FILE_EXISTS function. CHKFILE works much better; I just didn't know it existed.

Huh... this seems like it has some awesome stuff in it!

Nice

Protip: INPUT and LINPUT will pop up the on-screen keyboard regardless of what your XSCREEN is. I'm sure there's some other use for your custom keyboard though (non-blocking keyboard input? I dunno) Curious to try this out! You totally beat me to the idea of sprite shadows so let's see if I'm pleased… (I'm sure I will be anyway.)

Replying to:snail_
Protip: INPUT and LINPUT will pop up the on-screen keyboard regardless of what your XSCREEN is. I'm sure there's some other use for your custom keyboard though (non-blocking keyboard input? I dunno) Curious to try this out! You totally beat me to the idea of sprite shadows so let's see if I'm pleased… (I'm sure I will be anyway.)
The only thing I dislike about INPUT and LINPUT is that it interrupts anything else that's happening at the time, so if you want to be able to type and detect, say, the B button, you can't.

Replying to:haloopdy
Huh... this seems like it has some awesome stuff in it!
Yeah, it's really just a bunch of stuff that I've used myself in some programs, but I've been using it for so long and constantly changing it, so it's got a bunch of random things put together.

Replying to:snail_
Protip: INPUT and LINPUT will pop up the on-screen keyboard regardless of what your XSCREEN is. I'm sure there's some other use for your custom keyboard though (non-blocking keyboard input? I dunno) Curious to try this out! You totally beat me to the idea of sprite shadows so let's see if I'm pleased… (I'm sure I will be anyway.)
I made a LINPUT replacement function for my chat program. I would have released it separately, but instead of the function being run in a loop or something, you use it like regular LINPUT, and it will GOSUB @UPDATE every frame, which kind of limits its uses.

You could use SPLINK in SHADE so you don't have to update it every time the sprite moves:
COMMON DEF SHADE S
 VAR X,Y,Z
 SPCHR S+1,SPCHR(S)
 SPHOME S OUT X,Y
 SPHOME S+1,X,Y
 SPOFS S OUT ,,Z
 SPOFS S+1,,,Z+1 'make sure shadow is behind sprite
 SPCOLOR S+1,RGB(122,0,0,0)
 IF HANG!=90 THEN
  SPSCALE S+1,1,TAN(RAD(90-HANG))
 ELSE
  SPSCALE S+1,0,0
 ENDIF
 SPROT S+1,-ANG
 SPLINK S+1,S 
END

Replying to:12Me21
You could use SPLINK in SHADE so you don't have to update it every time the sprite moves:
COMMON DEF SHADE S
 VAR X,Y,Z
 SPCHR S+1,SPCHR(S)
 SPHOME S OUT X,Y
 SPHOME S+1,X,Y
 SPOFS S OUT ,,Z
 SPOFS S+1,,,Z+1 'make sure shadow is behind sprite
 SPCOLOR S+1,RGB(122,0,0,0)
 IF HANG!=90 THEN
  SPSCALE S+1,1,TAN(RAD(90-HANG))
 ELSE
  SPSCALE S+1,0,0
 ENDIF
 SPROT S+1,-ANG
 SPLINK S+1,S 
END
The only thing with that is that, while useful, it kind of throws off the main reason I have it update. The main reason is that if you change the sprite number automatically (like with SPANIM) or change it for a reason (like turning a character into a different facing character), it needs to update the shadow. While SPLINK would be useful, I also kind of dislike it for the purpose.