Jump to content



0

pfpixel placement

sprite v. playfield coordinat

1 reply to this topic

#1 boski OFFLINE  

boski

    Space Invader

  • 13 posts
  • Location:Janesville, WI

Posted Sat Oct 29, 2011 12:05 AM

So I'm trying to place a pixel directly center on my sprite, but unfortunately, even with my superb mathematics knowledge, the pixel is falling well below my sprite. Can someone take a quick look and let me know if I'm missing something? Thanks!


include div_mul.asm
player0x = 30 : player0y = 30
START

player0:
%00111100
%00100100
%11000011
%10000001
%10000001
%11000011
%00100100
%00111100
end

COLUP0=$0E
COLUPF=$0E
 
if joy0up then player0y = player0y-1
if joy0down then player0y = player0y+1
if joy0left then player0x = player0x-1
if joy0right then player0x = player0x+1
a = (player0x/5)
b = (player0y/4)
if joy0fire then c = c + 1
if !joy0fire then c = 0
if c = 1 then pfpixel a b flip
drawscreen
goto START

#2 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Sat Oct 29, 2011 2:11 AM

Two programs I studied
This one uses a missile - u=(missile1y-7)/8 : v=(missile1x-13)/4
This one a sprite - a=(player1x-13)/4 : b=(player1y-1)/8

Try one of those. It may help.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users