Jump to content



0

Adding a missile


7 replies to this topic

#1 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Wed May 31, 2006 9:03 PM

Ok, I've followed Andrews great tutorials and am up to the point where I have a cool lil' guy running around the screen.

I am now attempting to add a "missile". I was reading the Stella programmers guide I gathered that to get a missile to display I just had to enable it with
lda #1
sta ENAM0

Then at the correct x position (which I just did after the xpositioning code of the player):
sta RESM1

I do that straight after the player positioning and I thought i would see a missile that was as tall as my screen a couple of pixels right of my player. But I saw nothing. Is there anything else I need to set?

Thanks!

#2 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,993 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Wed May 31, 2006 9:58 PM

Need to set bit 1, not bit 0. . 2^0 = 1, 2^1 =2 so

lda #2
sta enam0

Edited by SpiceWare, Wed May 31, 2006 10:00 PM.


#3 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Thu Jun 1, 2006 12:07 AM

Damn... yep. Thanks for that Spiceware (or is it Darrell?)

#4 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Thu Jun 1, 2006 12:41 AM

Actually, I have another question for you (well I have thousands of questions, but I'll stick to the one on the top of the heap...)

I have 3 objects on screen now, and in the vertical blank time I do a WSYNC, then run the XPosition code for player 1, then another WSYNC then x positiong for player 2 and another WSYNC then Missile 1 postioning all using the "Battlezone variant"

That works lovely. but the Y positioning - how do I fit in all the ypositioning code for all the objects into a scanline? I am using the "skipdraw" method (i think!) like so:
	sec
	tya
	sbc SpriteEnd
	adc #SpriteHeight
	bcs .MBDraw3
	
	nop; Make y drawing always
	nop; use same amount of cycles
	sec
	
	bcs .skipMBDraw3
				
.MBDraw3
	lda (SpriteTablePtr),y
	sta GRP0
	sta GRP1
				
.skipMBDraw3

Do I just run exactly the same code for each object on screen? Is there a standard method to achieve the vertical positioning checks?

#5 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,993 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Thu Jun 1, 2006 10:05 AM

Darrell's my name, SpiceWare's my alias. I've been doing software under SpiceWare name since the early 80s. here's an example of my logo from 88.

It's all tradeoffs when programming the Atari as there's a limited amount of time to do everything you have to do. In Medieval Mayhem I'm controlling 5 objects, the playfield, changing the playfield color and reading the paddles. There's no way I could do that on every scanline so I'm using a 2-line-kernel where most things are updated every other scanline(the playfield has to be updated every scanline).

One of the tricks I'm using is my sprites are limited in the Y range they can be drawn at, so I've chosen to pad the graphics with 0s:
TopShieldFacingDown
	.byte zz________
	.byte zz__XXXX__
	.byte zz_XXXXXX_
	.byte zzXXXXXXXX
	.byte zzXXXXXXXX
	.byte zzXX____XX
	.byte zzX______X
	.byte zz________

	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	
TopShieldFacingSideways
	.byte zz________
	.byte zzXXXXX___
	.byte zz_XXXXX__
	.byte zz__XXXXX_
	.byte zz__XXXXX_
	.byte zz__XXXXX_
	.byte zz_XXXXX__
	.byte zzXXXXX___

	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	
TopShieldFacingDiagonal
	.byte zz___XXX__
	.byte zz__XXXXX_
	.byte zz_XXXXXXX
	.byte zzXXXXXXXX
	.byte zz___XXXXX
	.byte zz____XXX_
	.byte zz____XX__
	.byte zz____X___
TopShieldDead
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; 2 brick rows
	.byte 0,0,0,0,0,0,0,0; for "dead" shape

and just draw the shields on every line w/out using any skipdraw logic
	lda (P1Shield),y
	sta GRP0
	lda (P3Shield),y
	sta GRP1


#6 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Sat Jun 3, 2006 4:04 AM

Hmm, I'm not sure I understand how that differs from the "skipdraw" method - don't you still have to say somewhere "dont start drawing the shields until you get to scanline #xx?

#7 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 5,993 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Sat Jun 3, 2006 9:47 AM

It's different in that it's faster during the display kernel. I had too many things to display and could not spare SkipDraw's 17-18 cycles per player. The method I use only takes 8 cycles per player.

Outside of the kernel I have to add zeros to either side of the sprite image(taking up extra ROM space) and adjust the pointer to the sprite (the value in P1Shield) up/down based on the Y value.

#8 nmoog OFFLINE  

nmoog

    Space Invader

  • 44 posts

Posted Sun Jun 4, 2006 5:48 AM

Is that the kind of technique they would have used to make a frogger style game? I was thinking of doing something like this as a project to bring together all the stuff I've been reading here - I've got it kinda working, but I've just been ignoring all the line-changes that the sprites do mid-frame :)

What would be the best way to store multiple sprites on fixed y coordinates a-la frogger?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users