Jump to content

Photo

player vs playfield coordinates


4 replies to this topic

#1 Coolcrab OFFLINE  

Coolcrab

    Chopper Commander

  • 176 posts
  • Location:Stockholm

Posted Sun Jan 21, 2018 9:34 AM

I was wondering if there is any way to get the PFpixel coordinates of the PFpixel that is touched by the player during a collision. (I want to remove blocks that are touched by a player) 



#2 SpiceWare OFFLINE  

SpiceWare

    Draconian

  • 12,211 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Sun Jan 21, 2018 11:35 AM

X_POSITION / 4 will get you started.  In assembly that'd be:


lda X_POSITION
 lsr ; divide by 2
 lsr ; divide by 2
 
 
But by saying PFpixel I gather you're using batari Basic, so you'd be better off looking for help it its forum as the Newbies forum is really geared towards assembly.  Also, if I recall correctly, bB only uses the middle 32 playfield pixels so you'll need to use an offset along with the divide by 4. Something along the lines of (X_POSITION - 16) / 4. You'll likely need to fine-tune the 16 +/- 1 or 2.

#3 Coolcrab OFFLINE  

Coolcrab

    Chopper Commander

  • Topic Starter
  • 176 posts
  • Location:Stockholm

Posted Mon Jan 22, 2018 3:17 AM

Ah ok, I thought that this forum was also for bB. Sorry for that then. Could a mod maybe move it to the bB section? 

 

I tried your solution though, and it seems to semi work. Oddly enough only if the player moves into the block and not of the block moves into the player. (the play field is scrolling down.)

 



#4 SpiceWare OFFLINE  

SpiceWare

    Draconian

  • 12,211 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Mon Jan 22, 2018 9:12 AM

One thing to consider is an 8 pixel player can collide with up to 3 playfield pixels, so once you've done this(or whatever that 16 ends up being):

pfx = (xpos - 16)/4

 
the player could also have collided with pfx+1 and/or pfx+2.



#5 Coolcrab OFFLINE  

Coolcrab

    Chopper Commander

  • Topic Starter
  • 176 posts
  • Location:Stockholm

Posted Mon Jan 22, 2018 10:00 AM

Yes, but in this case thats a feature rather than a bug, as the player can only move in one line and has to remove all blocks it touches. 






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users