Banner
Summer C3 2020 begins in:
23 HOURS, 37 MINUTES AND 16 SECONDS
Views: 836,096,389
Time:
32 users online: B2De, Bernardo,  BTD6_maker, CalHal, chickaDEE Magazine, Darolac, DasFueller, Eduard, EmulaDuck, FailSandwich, flips_bad, ForthRightMC, fsvgm777, GaloombaCat, GbreezeSunset, Green Jerry, Ice Man,  JamesD28,  KevinM, Kingshadowraze, Milon Luxy, Narcologer, NewPointless, NoMoreStars, rafaelfutbal, Rykon-V73, Sancles,  slakkmichael, Sonck, StackDino, The Snootster, TheBiob - Guests: 73 - Bots: 63 Users: 45,604 (3,255 active)
Latest: k8747t
Tip: If you use custom music, make sure your ROM has been expanded to at least 1MB.Not logged in.
A sprite spawner?
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - A sprite spawner?
Pages: « 1 »
Hello. I'm really new to ASM and barely know how to do anything with sprites. Could someone explain to me how I could make flashing throw blocks and Koopas without shells spawn at a certain location? Thanks in advance.


The basic code to spawn a sprite is this:
Code
	JSL $02A9DE
	BMI EndSpawn
	TYX
	LDA #!SpriteState
	STA $14C8,x
	LDA #!SpriteNumber
	STA $9E,x

	LDA #!XLo
	STA $E4,x
	LDA #!XHi
	STA $14E0,x
	LDA #!YLo
	STA $D8,x
	LDA #!YHi
	STA $14D4,x
	JSL $07F7D2
EndSpawn:
	RTS


Replace the SpriteNumber define with the sprite you want to spawn, and SpriteState with the state you want it to be in (01 for most sprites, 09 with sprite 4-7 for shells and with sprite 53 for throwblocks). Then set the position in place of the XLo/XHi and YLo/YHi values, or you can set it to be equal to an address as well.

You can stick this in LevelASM; you don't have to use a sprite. If you still want to, though, then to spawn it at the sprite's position you'd use this varient instead.

Also, for spawning a throwblock, if you want it to still disappear after a certain amount of time, add this between the last JSL and the EndSpawn label:
Code
	LDA #$FF
	STA $1540,x

(or you can change the #$FF to however many frames you want it to last)

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Thank you so much! This helped a lot.
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - A sprite spawner?

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

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


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy