Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,531,429
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 05-04-24 11:39 AM
Guest: Register | Login

0 users currently in SMW Hacking | 1 guest

Main - SMW Hacking - A Few Questions. New thread | New reply


Wario
Posted on 02-12-09 03:45 PM (rev. 2 of 02-12-09 03:45 PM) Link | Quote | ID: 100819

Newcomer
Level: 5

Posts: 1/3
EXP: 406
Next: 123

Since: 08-16-07

Last post: 5559 days
Last view: 5408 days
Well I've had my fair share of problems with making sprites, so I decided
to ask some questions. Here they are:

Question 1: How would I set it up if I wanted to use STZ, but later in the code, wanted the same address not at 0 anymore?

Question 2: Now i've made a sprite Mario could stand on, but how do I make it so Mario moves with it?

Question 3:I've been wondering, when are the times that I'll HAVE to PLA/PHA? Because I can't figure it out.

Question 4: How do I make it where a 32x32 sprite actually stands on the bottum of its hitbox?

Question 5: What is a good address to make a 'Counter' with? the frame counter seems too random.

Question 6: What does the 'W' mean when people use LDA.W?

Question 7: Is there any way to make a routine depend on if the sprite is in the air?

Question 8: What does ORA do exactly?

Well, Thats about all(I think). I don't mind if all of these aren't answered, but atleast 2 or 3 of them would be nice.

blackhole89
Posted on 02-12-09 04:00 PM Link | Quote | ID: 100820


The Guardian
Moloch whose eyes are a thousand blind windows!
Level: 124

Posts: 2245/4196
EXP: 21546714
Next: 289887

Since: 02-19-07
From: Ithaca, NY, US

Last post: 479 days
Last view: 92 days



8. It bitwise-ORs the accumulator with the parameter. OR is a logic operator that is true (1) whenever one of the two inputs is true(1) and false(0) otherwise, i.e. bitwise-OR of 100010 and 001100 would be 101110.

7. Yes. Depending on whether you want Mario's sprite or any enemy sprites, you can check for some special value that the Y velocity is set to when he's standing on firm ground (It might have been -10, but I don't really remember anymore...) or Idunno.

6. A word parameter, i.e. 16 bits rather than 8. It's actually the same opcode as the byte LDA, but the assembler doesn't have a reliable way to determine whether a piece of code has the 16-bit A flag set at execution time, (cf. computability theory...) so it needs an additional cue as to whether write one or two bytes as the immediate value.

5. How is the frame counter "random"? It counts up by one every frame...

4. Not sure what you mean there.

3. Whenever you want to insert a piece of code that manipulates the accumulator between two pieces of previously present code where the piece before which you insert your code requires the accumulator state from the piece after which you insert it.

2. I don't remember.

1. As in you want to write something else to the address? Ensure the accumulator (A) is preserved, then LDA(.B, .W) #$(somevalue), STA $(the location you previously STZed to).

____________________



Wario
Posted on 02-12-09 04:54 PM Link | Quote | ID: 100822

Newcomer
Level: 5

Posts: 2/3
EXP: 406
Next: 123

Since: 08-16-07

Last post: 5559 days
Last view: 5408 days


5. How is the frame counter "random"? It counts up by one every frame...



Well then maybe I'm doing something wrong(I'm trying to make it to where a sprite erases itself in a certain ammount of frames, but it always seems to range from 1-5 seconds. Does it count the frames when on the overworld too?)



4. Not sure what you mean there.



Well would a picture help?
http://i233.photobucket.com/albums/ee21/45635/image-1.jpg
(Yes, its JPG. And my computer is being slow right now so I didnt fix it.)
The sprite has 32x32 clipping, but it interacts with the ground with a 16x16
interaction field, I believe.

Anyway, thanks for all the answers! It really helps!

boingboingsplat
Posted on 02-12-09 05:02 PM Link | Quote | ID: 100824


Giant Koopa
[PREFSTRING:wonderful bounciness]
Level: 74

Posts: 759/1292
EXP: 3636101
Next: 17443

Since: 07-23-07
From: Michicola

Last post: 4850 days
Last view: 4812 days
Posted by Wario
Well then maybe I'm doing something wrong(I'm trying to make it to where a sprite erases itself in a certain ammount of frames, but it always seems to range from 1-5 seconds. Does it count the frames when on the overworld too?)

Probably because when that code runs the frame counter isn't always at the same place, assuming you're doing something along the lines of "LDA $FrameCounter CMP #$blah BEQ Whatever"

Perhaps make a loop instead?

Posted by Wario
Well would a picture help?
http://i233.photobucket.com/albums/ee21/45635/image-1.jpg
(Yes, its JPG. And my computer is being slow right now so I didnt fix it.)
The sprite has 32x32 clipping, but it interacts with the ground with a 16x16
interaction field, I believe.

I'm not entirely sure what the problem is, but perhaps you could take a cue from the Giant Shyguy sprites made by Mattrizzle?

____________________
 

blackhole89
Posted on 02-12-09 05:08 PM Link | Quote | ID: 100825


The Guardian
Moloch whose eyes are a thousand blind windows!
Level: 124

Posts: 2246/4196
EXP: 21546714
Next: 289887

Since: 02-19-07
From: Ithaca, NY, US

Last post: 479 days
Last view: 92 days



Posted by Wario


5. How is the frame counter "random"? It counts up by one every frame...



Well then maybe I'm doing something wrong(I'm trying to make it to where a sprite erases itself in a certain ammount of frames, but it always seems to range from 1-5 seconds. Does it count the frames when on the overworld too?)


As boing said, the frame counter can be at pretty much any position when your sprite is created; additionally, it wraps around after frame 255 (being a single byte and everything), i.e. the longest interval you can measure using the frame counter alone is a bit over 4 seconds in NTSC. And even for measuring <=4 seconds reliably, you'd need to store the position of the frame counter at the creation of the sprite in some location uniquely identifiable with the sprite and check the difference between that stored byte and the frame counter.

____________________



Sukasa
Posted on 02-12-09 05:09 PM Link | Quote | ID: 100826


Red Birdo
Level: 92

Posts: 1661/2112
EXP: 7694283
Next: 62654

Since: 02-19-07

Last post: 4456 days
Last view: 3227 days
If you want it to die after a specific amount of time, there are some general-purpose sprite tables that you can write a number to and they'll count down to zero from it. I don't have the specific address, though.

Wario
Posted on 02-12-09 05:21 PM Link | Quote | ID: 100827

Newcomer
Level: 5

Posts: 3/3
EXP: 406
Next: 123

Since: 08-16-07

Last post: 5559 days
Last view: 5408 days
Well that about all I needed to know, Thanks everyone!(The 32x32 interaction field isn't important to me, yet. I was just wondering)

Main - SMW Hacking - A Few Questions. New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.018 seconds. (339KB of memory used)
MySQL - queries: 57, rows: 83/84, time: 0.013 seconds.