Jump to content



0

reseting player sprites


4 replies to this topic

#1 swiley OFFLINE  

swiley

    Combat Commando

  • 2 posts

Posted Wed Dec 16, 2009 9:45 AM

I noticed that if you reset a player multiple times on one scan line it isn't drawn at all. I lost the original program I found this in (I was afraid of asking then) so I modified the How to Draw a Playfield example to show this. Is this a bug in stella, or can you not do this on a real Atari? I thought I read somware that you could do this to make a backround that repetaed the same pattern over and over again but I can't remember where that was. thanks in advance for your answeres.

Attached Files



#2 e1will OFFLINE  

e1will

    Moonsweeper

  • 338 posts

Posted Wed Dec 16, 2009 10:24 AM

View Postswiley, on Wed Dec 16, 2009 9:45 AM, said:

I noticed that if you reset a player multiple times on one scan line it isn't drawn at all. I lost the original program I found this in (I was afraid of asking then) so I modified the How to Draw a Playfield example to show this. Is this a bug in stella, or can you not do this on a real Atari? I thought I read somware that you could do this to make a backround that repetaed the same pattern over and over again but I can't remember where that was. thanks in advance for your answeres.

I haven't gone through the .asm you posted, but here's how I do it in the game I'm working on:

WriteLives
	STA WSYNC
	NOP3
WriteLives_loop
	LDA graphicPtr,Y
	DEY
	BPL KeepOnWriting
	RTS
KeepOnWriting
	STA.w GRP0
	STA GRP1
 REPEAT 8
	STA RESP0
	STA RESP1
 REPEND
	STA RESP0
	STX GRP1
	STX GRP0
	JMP WriteLives_loop

It's a little clunky, but it works. Give that a try in Stella... works fine with 2.8.x and 3.0.

Hope this helps.

--Will

#3 e1will OFFLINE  

e1will

    Moonsweeper

  • 338 posts

Posted Wed Dec 16, 2009 10:26 AM

Oops, I should have mentioned you'll need to set NUSIZn appropriately before calling that:

   LDA #$01
   STA NUSIZ0
   STA NUSIZ1

--Will

#4 swiley OFFLINE  

swiley

    Combat Commando

  • 2 posts

Posted Wed Dec 16, 2009 11:05 AM

Thanks so much! that worked!

#5 SeaGtGruff OFFLINE  

SeaGtGruff

    River Patroller

  • 4,543 posts
  • Location:Georgia, USA

Posted Wed Dec 16, 2009 7:18 PM

View Postswiley, on Wed Dec 16, 2009 11:05 AM, said:

Thanks so much! that worked!
Yes, it's just the way the TIA works. If you reset the position of a player on a given scan line, its primary copy will not appear on that scan line-- that is, unless it's already been drawn. For example, if you reset player0 to screen position 2 on the last line of VBLANK before the active area, then it will appear at that position on (active) scan line 1. Then on line 1 you could reset player0 to screen position 18, and it might not display a second time on line 1, but it will display there on line 2. Then on line 2 you could reset player0 to screen position 34, and it will display there on line 3. Do as long as you wait until after the player has been drawn on a line, and then reset it to a position to the right of that one, it will appear once per line, and will be moved to the right on the next line, like this:

...XXXXXXXX
...................XXXXXXXX
...................................XXXXXXXX
etc.
Note that you cannot do the same thing going to the left:

...................................XXXXXXXX
...................XXXXXXXX
...XXXXXXXX
Instead, you would have to leave at least one blank line between the leftward repositionings:

...................................XXXXXXXX
.......................
...................XXXXXXXX
.......................
...XXXXXXXX
If you keep resetting a player multiple times on each line, chances are it won't ever get a chance to be drawn, because on the next line down-- where it would first appear at the new position-- you'll be resetting it to some position that's way to the left of the last position you'd set it to on the previous line, see?

On the other hand, the extra copies of a player will be displayed on the line where you reset the player, as long as you wait long enough between each strobe of RESPx to give the first extra copy a chance to be displayed. So if you set NUSIZx to display 2 copies, you can get one copy that displays (the second copy), and keep getting additional copies of it by repeatedly strobing RESPx (but not too quickly between each strobe).

It's confusing, but once you "get" it, it's easy. :)

Michael




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users