It is currently Wed Jun 19, 2019 4:02 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: fire
PostPosted: Wed Mar 01, 2006 9:41 pm 
Offline
User avatar

Joined: Tue Jan 17, 2006 10:39 am
Posts: 143
Location: North Carolina
Just wondering ... in the original Legend of Zelda ... what gives the fire in the dungeons that flickering look? Is it like load flame sprite set one ... count down (with like a bne loop) and then load flame sprite two and have that repeat over and over?


Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 10:12 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2157
Location: Minneapolis, Minnesota, United States
are you referring to this fire?:

Image

I think they just flip the sprite horizontally to make it look like a dancing flame. They probably do it like this:

Say here's the flame (this fire looks horrid...)

Image

You'd want to store $40 in the sprite's attribute byte to get it to flip. But if your not careful, if you store $40 in every sprite attribute making up that flame, it will look like this:

Image

But say this is what tiles make up the sprite:

00 01
02 03

You'd want to switch those tiles around, and then flip it. Like this:

01 00
03 02

And you'd get this lovely image:

Image

They probably change the attribute from $00 to $40 and from $40 to $00 and swap tile indexes like every 10, 15 frames or so. I don't know for sure, but it looks like that's what they do.

Am I talking out of my ass? Or am I making any sense?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 10:37 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1465
To summarize: there is only one set of sprites (4 tiles total) used for the flame, and the animation is accomplished solely by mirroring the graphic horizontally (by using the appropriate sprite attribute bit AND swapping the left and right halves).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 10:56 pm 
Offline
User avatar

Joined: Tue Jan 17, 2006 10:39 am
Posts: 143
Location: North Carolina
thanks for the explaination. where would code like that usually take place? main loop, NMI ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 11:36 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2157
Location: Minneapolis, Minnesota, United States
Probably NMI. Usually things like this happen in an NMI routine. And since it has to do with sprites, and dealing with sprite DMA, it'd probably be best that it'd be in NMI.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 12:47 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4181
Personally, I'd put it in the Game Logic, as what a fire object does during its turn, or better yet, separate animation logic from game logic.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 4:41 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11369
Location: Rio de Janeiro - Brazil
lynxsolaris wrote:
thanks for the explaination. where would code like that usually take place? main loop, NMI ?

It really depends. The quick way to have something happen at the constant rate of 60 times per second (once per frame) is by putting it in the NMI. So, if you do the "flame logic" somewhere in the NMI it will work just fine. But as your project grows bigger, you'll want to avoid putting much stuff inside the NMI, so it doesn't get too big and there is a risk that 2 NMI's will overlap (you saw how overlaping NMI's can be nasty).

Eventually you'll want to put this along with the main game logic, where you'll also be processing the player's movements and collisions, physics, enemy/object AI, and all that stuff. And you'll probably want all that outside of the NMI. Some commercial games do have all their logic inside NMI, though. I guess that if you keep a "last NMI ended fine" flag and check it at the start of every NMI you can have all your code there, because if an NMI starts before the last one finished it will just detect that and RTI. And you'd lose a frame, as expected.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 6:18 am 
Offline
User avatar

Joined: Tue Jan 17, 2006 10:39 am
Posts: 143
Location: North Carolina
Thanks for the information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group