Jump to content
Captain Spazer

DPC+ question thread

Recommended Posts

I just started fiddling with DPC+, it is awesome, but some things are different so it takes some getting used too.

 

My first question on how to do stuff in DPC+ is: If I want a wider player0 sprite, how do I do that? The usual NUSIZ0= $07 doesn't do anything it seems?

 

EDIT: I found the problem, I placed it in the wrong spot

Edited by Captain Spazer

Share this post


Link to post
Share on other sites

Yes, I corrected that mistake.

 

Another question, I know pfscroll 1 4 4 scrolls the pfcolors up, how do I scroll the pfcolors down?

It says how right here:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#dpc_pfscroll

 

"The playfield strips are 256 bytes in size, so if you want to scroll down, use "pfscroll 255" to scroll down by 1, "pfscroll 254" to scroll down by 2, and so on."

  • Like 2

Share this post


Link to post
Share on other sites

Making progress, I think I'm starting to get the hang of things with dpc+ now, it's still a little tricky but I adore the features, don't know how I managed without them.

 

I have an issue with a piece of code, I'm not sure if it has something to do with how dpc+ works or if it's me that written the code badly, to me it looks fine. The idea is that there is a random chance that a car appears on screen, then travels down, then repeats the cycle of randomly deciding whether to put it back top or not, problem is the code never starts, it's placed in the main loop. Any thoughts?

 rem player1 is car
 if d = 0 then (e = rand&3)
 if d = 0 && e = 2 then d = 1
 if d = 1 then player1x = 70 : player1y = 78 : d = 2
 if d = 2 then player1y = player1y + 1 : player1x = player1x - 1
 if collision(player1,playfield) then player1x = player1x + 1
 if player1y > 150 then d = 0
 if d = 0 then player1x = 200 : player1y = 200
Edited by Captain Spazer

Share this post


Link to post
Share on other sites

It would help if you dim _name = d. This helps to track your variables and if you name it that helps what you want to do.

dim appear= a
dim appear = rand&3

If appear = 2 then ....

Just a quick FYI, using the old memory bag on this one.

Edited by Lewis2907

Share this post


Link to post
Share on other sites

http://atariage.com/forums/index.php?app=core&module=attach&section=attach&attach_id=464717

 

May help. It's a lot of borrow code. There was a programmer making a Grand Theft Auto style game. I found that code and expanded non it to learn more. My notes are not as detailed as my newer programs, but the thread should help with DPC as I was still learning and the others in the forum helped me. Hope this helps.

Share this post


Link to post
Share on other sites

I don't know if it will help, but I would try rewriting this line:

if d = 0 then (e = rand&3)

As this:

 if d = 0 then e = (rand&3)

Share this post


Link to post
Share on other sites

Collision in DPC+ is something I don't understand quite yet, but if I'm on the right track, I need to see if for example player1y is = to player0y + - height and player1x = player0 + - width?

Share this post


Link to post
Share on other sites

There's one player0 and nine player1, only way to differentiate between the player1's is by their x and y variables so you create hitboxes,

 

How complex they need to be depends on how your players move

If they move left and right and up and down completely freely all over the place you would need to create an entire box

 

let's assume they are both 8 pixels wide

 

if player0x<=player1x+8 then ; if left side of player0 is smaller than or equal to right side of player1

 

That's a start but it will be true even if player0 is all the way to left side of the screen and player1 all the way to the right, so we need to box it in even more..

 

if player0x<=player1x+8 && player0x+8>=player1x then ; and right side of player0 is greater than or equal to left side of player1

 

now it's true if they touch or overlap horisontally, but it will still be true even if one player is at the top of the screen and one at the bottom, so box in some more..

 

if player0x<=player1x+8 && player0x+8>=player1x && player1y+player1height>=player0y ; and bottom of player1 is bigger than or equal to top of player0

 

if player0x<=player1x+8 && player0x+8>=player1x && player1y+player1height>=player0y && player1y <= player0y+player0height ; and top of player1 less than or equal to bottom of player0

 

 

Now you have a complete box

 

Since boxes are square and most sprites are not you can skip the collision check if there's no hardware detection between player0 and player1

 

if !collision(player1,player0) then goto _skipcheck ; skips if no pixels are overlapping

if player0x<=player1x+8 && player0x+8>=player1x && player1y+player1height>=player0y && player1y <= player0y+player0height then..

if player0x<=player2x+8 && player0x+8>=player2x && player2y+player2height>=player0y && player2y <= player0y+player0height then..

_skipcheck

 

that should make it pixel perfect.

 

 

This example is very good, he changes the width of player0, so the width is stored in temp5

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#dpc_collision_detection

Share this post


Link to post
Share on other sites

I was soon to ask this question regarding collision. I was getting tripped up and making all sorts of weird code to try and get it hammered out. I will have to try this out tomorrow. Hopefully I have time. I have jury duty so plan on sitting around all day at the courthouse.

Share this post


Link to post
Share on other sites

I was confused at first when every time I had a collision between player0 and player 2-4 my player1 sprite kept bouncing around. I had to reread the DPC+ page a few times but had a hard time understanding it at first.

Share this post


Link to post
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.

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...