Jump to content
IGNORED

How do I accomplish checking whether certain parts of a playfield are gone (aka Pac-Man eating all the dots) to then load level 2?


Words Fail

Recommended Posts

I've got some blocks on the playfield. Let's assume level 1 has 16 blocks. I can fly my ship over them and they disappear.. aka Pac-Man eating dots.

 

I can't figure out how to make the game know you got all the blocks and it should load level 2.

 

I can set variable=16 and do variable=variable-1 until it reaches 0, but I've no way to actually tell whether you ran over a block or just dead space. Right now I'm checking x and y coordinates of the ship and doing a pfhline to get rid of the block. If the block was already gone, it's just wasted cycles because my game doesn't know whether it was gone or not to begin with.

 

What do I do?

 

(if you're curious why I used pfhline is because I was using two pfpixel commands.. pfhline takes up a little more cycles (294 vs 160), but it lessens the length of my code, so I could fit this whole crap in bank 2)

 

 

Edited by Words Fail
Link to comment
Share on other sites

I had done something similar in my project Lawn Boy. Once certain amount of blocks are cleared the level is over.

 

If I remember correctly I used a pfread to check if there was a block or not and if there was I would use a pfpixel to turn it off. I then had a variable to would add up until the number of cleared pixels equal the number of set playfield pixels I started with. 
 

You can check out my .bas file here.

Link to comment
Share on other sites

I think I use the temp variables to define what the coordinate is since the playfield pixels don’t match up to the player coordinates. 
 

so temp1 would equal the X conversion and temp2 the Y - something like temp1=(player0x/8)-3 … or whatever. 
 

pfread(temp1,temp2) 

pfpixel temp1 temp2
 

It all depends on your playfield settings for how the coordinates will work so the conversion for the game I posted would be different then in my other games, like Cone Ball, which has just a standard bB kernel, or Crossdock, which has a standard kernel with variable playfield heights. 
 

I can’t say what the right equation would be for your game because I don’t know your code and because I usually just do a look up on Random Terrain’s website or my other games and cut and paste. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...