Jump to content

Photo

I can place pfpixels, but not remove them


3 replies to this topic

#1 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • 110 posts

Posted Fri Jan 25, 2019 2:40 PM

Im having a bit of trouble with my code for a map maker, I can make the player place blocks, but not remove them, any ideas on how to do that?

 x = (missile0x-18)/4 : y = (missile0y)/8
 x = (missile0x-18)/4 : y = (missile0y)/8
 if joy0fire && collision(playfield,missile0) then pfpixel x y off
 if joy0fire then pfpixel x y on

I figured it out... I just had to swap places with these 2 lines:

 if joy0fire then pfpixel x y on
 if joy0fire && collision(playfield,missile0) then pfpixel x y off

Edited by Captain Spazer, Fri Jan 25, 2019 2:47 PM.


#2 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • 11,618 posts
  • Location:Salem, Oregon

Posted Fri Jan 25, 2019 3:01 PM

How I would do this would be

if joy0fire && !a{0} then a{0}=1
if !joy0fire && a{0} then pfpixel x y flip : a{0}=0

the a{0} is needed as a flag to make sure whether the joy0fire is pressed or not. !=unpressed.



#3 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Fri Jan 25, 2019 3:17 PM

Thank you for the tip =)



#4 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Fri Jan 25, 2019 4:22 PM

while on the topic of pfpixel collision, how do I calculate for larger missiles?

 x = (missile0x-18)/4 : y = (missile0y)/8


Edited by Captain Spazer, Fri Jan 25, 2019 4:23 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users