Banner
Views: 575,553,535
Time: 2017-10-20 04:18:49 PM
14 users online: Aguni_, Conal the Snowman, o smwcentral creator ersanio, Febreeze (TM), Ghoulden Yoshi, Nate "RAGE!1!!" Spidgewood, o Mugi, KI-27052, o Monsieur Paresseux, spookydude999, o Satan, smwcentral, white_moth, yoshifanatic - Guests: 42 - Bots: 200Users: 32,730 (1,330 active)
Latest: SuperHigginsWorld444
Tip: Try sketching out ideas for overworlds and levels. Even if they don't manage to fit into Lunar Magic completely, at least you have a base to work from, instead of doing it all from scratch.Not logged in.
Sprite/Block/HDMA/ASM Code Library
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library
Pages: « 1 2 3 4 5 6 ... 9 10 » Thread Closed
Since Bio's original post was quite messy and the code snippets were unorganized, I've rewritten the first post. In this thread you will find commonly used code snippets and routines which you can use in your blocks, sprites and patches.

Blocks:
Change Map16 Number (load the Map16 tile in X, it can be 8-bit or 16-bit)
Causes a block to disappear
Causes a block to shatter
Causes a block to shatter on sprite contact
Check which side of a block Mario touched

Sprites:
Causes the sprite to explode like a Bob-omb
Draw smoke at sprite's position
Stores Mario to the sprite position
Stores sprite to Mario's position
Horizontal proximity check
Vertical proximity check
Spawn a normal sprite
Spawn a custom sprite
Spawn an extended sprite
Set sprite (extended, regular or minor extended) speed based on Mario's speed
Cape collision detection
Fireball Contact Routine
Sprite Interacts With Map16 Tile xxx.

HDMA:
Bright blue to darker blue, background colour gradient. ($2132)
Blue sky gradient
Green sky gradient (Image)
Pink sky gradient (Image)
Night sky gradient (Image)
Sunset gradient (Image)
Window effect (Image)
Wavy HDMA effect
HDMA Brightness gradient

Misc:
Yoshi's Earthquake
Pointer Subroutine
Random Number Generation (Ersanio)
Random Number Generation (1024)
Reset the game
The for() loop in ASM
Lose Yoshi
Convert time to binary
Use JSL with RTS
Hex -> Dec (short)
Hex -> Dec (long)
Layer 3 scroll (left and right codes included)
Stop level at a certain screen (assuming level moves from bottom to top)
Stop level at a certain screen (assuming level moves from top to bottom)
Stop level at a certain screen (assuming level moves from left to right)
Stop level at a certain screen (assuming level moves from right to left)
Find the number ($13BF format) of the level the current player is on.
Wouldn't the Wiki be the perfect place for things like this?
I'm not sure if the custom sprites section is the right place to submit this, that's why I didn't approve that submission (but someone else did).

... but I don't see anywhere else to submit it to (besides making a wiki article), so I guess it's ok.

I could make a subroutine section, but I didn't get the coder position (nobody did). A subroutine section would be nice, though. I have many things to submit to it.

EDIT: nevermind, that wouldn't be a good idea at all

Originally posted by smwedit
I could make a subroutine section, but I didn't get the coder position (nobody did)


That wouldn't be a good idea, even if you were a coder. When newbies see all those sections, they probably think "Oh, I want to add subroutines in my hack, they'd look cool!" and stuff.
Also, I don't see why it has to be a downloadable .zip when it's just a text file. You could make an article in the wiki or upload a text file to someone's webspace, and write all the codes in it.

Anyway, this is great for ASM beginners like me. Thanks!


--------------------


 
Originally posted by Smallhacker
Wouldn't the Wiki be the perfect place for things like this?

I kinda forgot the wiki existed while making this... It do seem like a much better idea than filling the custom sprite and block section. a subroutine section would probably the best but the wiki is fine enough:P

I will leave this thread open for a while to allow others to voice their opinion
My opinion is that it may be good to leave this thread here as a locked sticky and have a link to the wiki page. That way more people will know it exists when they come looking for information (I mean, after all, Bio said it all when he stated "I forgot the wiki even existed".

One thing I would suggest with things like this:
This is pretty detailed stuff for a beginner. I can make blocks, but I am new to sprite ASM. I just started learning it a few days ago, and most of it is well documented in the information that came with Sprite Tool, so it is easy to pick up since I know some basic ASM. With more advanced codes like this cape thing, there needs to be documentation and comments in the code so we know what to do with it, and how it works. Maybe include some basic examples of how the code would look in a real situation for those of us who are visual learners.

[?]

--------------------
I've removed my NoFades patch until I can find the brightness code for Star Road warps.
As you can see here, my attempt to add it to the wiki got a lot of weird problem(if anyone can delete it, do it), so I decided I would just host them on my noob freeweb site
*puts in <nowiki> tags*
ok, I fixed the wiki, but I don't know why it wouldn't work without the tags o_O
It didn't work properly due to some rows beginning with a tab instead of a space.
LOLBUMP
*shot*
I felt like adding some code to this thread. So here is a simple brightness gradient code, for use with sprite tool, insert as custom sprite:

http://ersan00b.googlepages.com/HDMABRIGHTNESSGRADIENT.asm

shazam

And don't forget to check the first post in this thread!

Another routine: Yoshi's Earthquake routine (When you have a yellow shell in your mouth and stuff)

http://ersan00b.googlepages.com/YoshiEarthQuake.asm


yay, this thread is up and running... Let me find some code templates and what not.

--------------------
Kawaii !!


  
  
 



Breaking/shatter code for blocks

LDA #$02 ; Replace block with blank tile
STA $9C
JSL $00BEB0

PHB
LDA #$02
PHA
PLB
LDA #$00 ;set to 0 for normal explosion, 1 for rainbow (throw blocks)
JSR $028663 ;breaking effect
PLB

It messes up with certain 'acts like' settings, though. If it's set to 25 and is glitching, try setting it to 1E6.
(This is already in a page that Bio linked, but there's some info he missed.)


 
 
       

Fluffy video games by me and Raibys!
 
 
   
 
 
Finally finished disassembling the change in the next map16 routine used in many blktool block, wich for some strange reason, nobody bothered to disassemble yet

here

the routine is very large and not fully documented, but it should be easy enough to do variation wich affect nearby block and change to any map16

this also mean the map16++ patch is now mostly useless.
next is using the stripe image table in custom sprite...

Originally posted by Bio
Finally finished disassembling the change in the next map16 routine used in many blktool block, wich for some strange reason, nobody bothered to disassemble yet

here

the routine is very large and not fully documented, but it should be easy enough to do variation wich affect nearby block and change to any map16

this also mean the map16++ patch is now mostly useless.
next is using the stripe image table in custom sprite...

that is going to be very useful. thanks bio

--------------------
Kawaii !!


I ripped the contact routine for contact with fireballs. It should be useful for custom boss HP.

Fireball Contact Routine

JOIN SMWR TODAY!
Hacking, Playing, GFX, ASM and Music contests seperated for beginners, advanced hackers and pros!
FIRST HACKING CONTEST STARTED!! JOIN NOW!!
smwr.bplaced.net

I have a question to the random number generator: Where can I adjust what's the max number? I want either 0, 1, 2 or 3.

1024: THAT'S WHAT I'VE SEARCHED!! Thank you!

--------------------
Super Yoshi World - 0.5 %
Restarting.

The Yoshi Parade - 1%
Just started. Welcome Level is currently v3.




Superyoshi's SMW Hacking Blog
Superyoshi's Shack - for random crap
Thanks to everyone who voted me in the C3 voting. You have recieved a PM with something special!


[Suyo|MakeGame]I'm sure you're missing Ersan so I'm doing it for him
[Suyo|MakeGame]Romi..............................
[Romi]Superyoshi.......................................................
This is extremely useful. I wish there were a bit more routines, but hey, this is already great.

--------------------
Your layout has been removed.
VERY useful. Thank you, Bio, Smallhacker, edit1754, et al. I have two things to ask, though:

1) If I want a block to change to the PREVIOUS Map16 block instead of the next one...

clc ; |Set map16 number to change to current's +1
adc #$0001 ;/

...should I just replace CLC and ADC with SEC and SBC in this part of the code? (And, now that I think of it...does this routine only change the block's graphics, or does it change its properties to those of the next Map16 tile as well?)

2) What are all the block numbers for the Map16 tile-generating routine at $00BEB0? It appears that #$02 is a blank block (tile 25) and #$0D is a brown used block, but I don't see any pattern there. What about all the other possible values? Is there a list of these anywhere?
I can't acess SMWWiki, and in the backup I didn't find it so... Does someone have the Fireball Contact Routine?
I need a copy of the fireball contact routine if anyone has it. It's not in the SMWiki backup.

--------------------
I've removed my NoFades patch until I can find the brightness code for Star Road warps.
Pages: « 1 2 3 4 5 6 ... 9 10 » Thread Closed
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Sprite/Block/HDMA/ASM Code Library

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2017 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 21

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented