+Lewis2907 Posted November 26, 2020 Share Posted November 26, 2020 I'm going through the example programs I have and searching the forum, but I can't find an example for DPC using player2 playfield detection. I'm okay with the bouncy effect as I know the smooth effect that RT likes to use is difficult and takes time. It's been a while since I have played with Bb and I'm almost relearning some stuff and looking at things differently as well since I took a break from Bb as a hobby. Below is a snippet of the code I'm using. ;*************************************************************** ;*************************************************************** ; ; Player 1 movement and boundaries ; if collision(playfield,player1) then gosub __Knock_Player_Back gosub __Move_Enemy __Knock_Player_Back player1x = player1x - P1_X player1y = player1y - P1_Y return **************************What I would like to use or something simple (DPC+ is not simple lol)******************************** ;*************************************************************** ;*************************************************************** ; ; Player 2 movement and boundaries ; if collision(playfield,player2) then gosub __Knock_Player_Back gosub __Move_Enemy2 __Knock_Player_Back2 player2x = player2x - P2_X player2y = player2y - P2_Y return Quote Link to comment Share on other sites More sharing options...
CapitanClassic Posted November 26, 2020 Share Posted November 26, 2020 (edited) Because P2-P9 are virtual sprites (and actually share P1 sprite), you cannot do simple collisions with the playfield like you do with P0. (why aren’t you using player0 for first player, and player1 for second player) What I did was set the kernel option to improve collision detection with virtual sprites. Quote set kernel_options collision(player1,playfield) Then I track the x/y position of the virtual sprite against the “on” playfield pixels. ; get player position with respect to playfield pixels ; temp2 will contain the P1 sprites upper-left location in 4x4 pf pixels ; temp3 is P1 upper-left y position in pf pixels temp2 = (player1x - 16) / 4 tenp3 = (player1y/4) ; did some other math here, ; because my spites are bigger than 1 playfield pixel ; check for collisions if pfread(temp2,temp3) then goto __handleP1PfCollision https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html Quote When a virtual sprite collides with the playfield, you won't know exactly which one did it without coordinate checking. PS: you must drawscreen before doing any collisions. Edited November 26, 2020 by CapitanClassic Quote Link to comment Share on other sites More sharing options...
+Lewis2907 Posted November 26, 2020 Author Share Posted November 26, 2020 Thanks. I forgot about swapping the players out in DPC. It's been like 1.5 years if not longer since I really had time to play around with Bb and I kinda forgot some stuff. I'm looking at my old stuff and the notes I have in there to help me remember. Thanks again. Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted December 4, 2020 Share Posted December 4, 2020 I think previously people have attempted to come up with assembly routines that treats the playfield data as a collision mask. Still in the baby stages with 6502 and 68k assembly myself.. someday! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.