Jump to content

Photo

DPC+ question thread


16 replies to this topic

#1 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • 110 posts

Posted Tue Jan 29, 2019 8:53 AM

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, Tue Jan 29, 2019 9:13 AM.


#2 Karl G ONLINE  

Karl G

    Dragonstomper

  • 732 posts

Posted Tue Jan 29, 2019 11:29 AM

NUSIZ0 should work as normal.  Make sure it is set in your game loop.



#3 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Tue Jan 29, 2019 12:03 PM

Yes, I corrected that mistake.

 

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



#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,863 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Tue Jan 29, 2019 1:29 PM

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



#5 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Tue Jan 29, 2019 1:50 PM

Ahh, I missed that, thank you.



#6 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Wed Jan 30, 2019 6:28 AM

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, Wed Jan 30, 2019 6:31 AM.


#7 Lewis2907 OFFLINE  

Lewis2907

    Moonsweeper

  • 317 posts
  • Location:Senatobia, MS

Posted Wed Jan 30, 2019 6:38 AM

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, Wed Jan 30, 2019 8:12 AM.


#8 Lewis2907 OFFLINE  

Lewis2907

    Moonsweeper

  • 317 posts
  • Location:Senatobia, MS

Posted Wed Jan 30, 2019 6:41 AM

http://atariage.com/...ttach_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.

#9 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Wed Jan 30, 2019 7:05 AM

Thank you for providing the code, it answers a lot of my questions



#10 Karl G ONLINE  

Karl G

    Dragonstomper

  • 732 posts

Posted Wed Jan 30, 2019 7:35 AM

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)


#11 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Wed Jan 30, 2019 1:16 PM

d also has to be 0 to begin with for it to do anything



#12 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Wed Jan 30, 2019 2:15 PM

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?



#13 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 180 posts

Posted Wed Jan 30, 2019 4:02 PM

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



#14 KevKelley OFFLINE  

KevKelley

    Chopper Commander

  • 149 posts
  • Lots of hobbies, little time, loads of fun.
  • Location:Orlando

Posted Wed Jan 30, 2019 4:22 PM

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.

#15 Captain Spazer OFFLINE  

Captain Spazer

    Chopper Commander

  • Topic Starter
  • 110 posts

Posted Wed Jan 30, 2019 4:32 PM

So far so good, that made things work out!



#16 KevKelley OFFLINE  

KevKelley

    Chopper Commander

  • 149 posts
  • Lots of hobbies, little time, loads of fun.
  • Location:Orlando

Posted Wed Jan 30, 2019 4:38 PM

Cool.

#17 KevKelley OFFLINE  

KevKelley

    Chopper Commander

  • 149 posts
  • Lots of hobbies, little time, loads of fun.
  • Location:Orlando

Posted Wed Jan 30, 2019 4:42 PM

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.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users