Jump to content
IGNORED

Good ol' fashioned multisprite almost working


Rabbit 2600

Recommended Posts

I have almost gotten multisprite collision working the old fashioned way without DPC+ but I hit a small snag.

 

The collision between missile0 and player1 and player2 works and they dissapear when the missile is at the same x position as them. But it dosn't work so well with player3 and player4. When missile0 collides with either player3 or player4 both of them dissapears.


 if collision(missile0, player1) && missile0x = player1x then player1y = 255

 if collision(missile0, player1) && missile0x = player2x then player2y = 255

 if collision(missile0, player1) && missile0x = player3x then player3y = 255

 if collision(missile0, player1) && missile0x = player4x then player4y = 255

Entire Code:

 rem Generated 2013-10-19 17:39:33 by Visual bB Version 1.0.0.554
 rem **********************************
 rem *<filename>                      *
 rem *<description>                   *
 rem *<author>                        *
 rem *<contact info>                  *
 rem *<license>                       *
 rem **********************************

   set kernel multisprite

        set smartbranching on

                                  dim _P1_L_R = player1x.a
                                  dim _P1_U_D = player1y.b
                                  dim _P0_L_R = player0x.c
                                  dim _P0_U_D = player0y.d
                                  dim _player0a = e
                                  dim _player0b = f

 player1x = 110 : player1y = 70
 player2x = 130 : player2y = 20
 player3x = 30 : player3y = 20
 player4x = 30 : player4y = 70
 player0x = 50 : player0y = 50
 missile0x = 200 : missile0y = 200


BATTLEFIELD

  player0:
   %00011111
   %11111111
   %00111110
   %11111111
   %00011111
end

   player1:
   %00011111
   %11111111
   %00111110
   %11111111
   %00011111
end

   player2:
   %00011111
   %11111111
   %00111110
   %11111111
   %00011111
end

   player3:
   %00011111
   %11111111
   %00111110
   %11111111
   %00011111
end

   player4:
   %00011111
   %11111111
   %00111110
   %11111111
   %00011111
end

 _COLUP1 = $0E

 COLUP2 = $40

 COLUP3 = $D4

 COLUP4 = $64

 COLUP0 = $1E

 COLUPF = $0E



 playfield:
 ................
 ................
 ................
 ................
 ................
 XXXXXXXXXXXXXXXX
 X...............
 X...............
 X...............
 X...............
 XXXXXXXXXXXXXXXX
end




 scorecolor = $0E

 drawscreen

        if joy0right then _P0_L_R = _P0_L_R + 0.30
        if joy0left then _P0_L_R = _P0_L_R - 0.30
        if joy0up then _P0_U_D = _P0_U_D + 0.30
        if joy0down then _P0_U_D = _P0_U_D - 0.30

 if joy0left && joy0fire then missile0x=player0x : missile0y = player0y : goto MISSILELEFT


 if collision(missile0, player1) && missile0x = player1x then player1y = 255

 if collision(missile0, player1) && missile0x = player2x then player2y = 255

 if collision(missile0, player1) && missile0x = player3x then player3y = 255

 if collision(missile0, player1) && missile0x = player4x then player4y = 255



MISSILELEFT
 missile0x = missile0x - 1

 goto BATTLEFIELD
Link to comment
Share on other sites

Okay, I managed to fix the issue with the missile collision.

 

But, I'm having issues with movement with player2-4. Movement in player1 works fine. Any thoughts?


 if _P1_L_R < _P0_L_R then _P1_L_R = _P1_L_R + 0.10
 if _P1_L_R > _P0_L_R then _P1_L_R = _P1_L_R - 0.10
 if _P1_U_D < _P0_U_D then _P1_U_D = _P1_U_D + 0.10
 if _P1_U_D > _P0_U_D then _P1_U_D = _P1_U_D - 0.10

 if _P2_L_R < _P0_L_R then _P2_L_R = _P2_L_R + 0.10
 if _P2_L_R > _P0_L_R then _P2_L_R = _P2_L_R - 0.10
 if _P2_U_D < _P0_U_D then _P2_U_D = _P2_U_D + 0.10
 if _P2_U_D > _P0_U_D then _P2_U_D = _P2_U_D - 0.10

Source:

 rem Generated 2013-10-19 17:39:33 by Visual bB Version 1.0.0.554
 rem **********************************
 rem *<filename>                      *
 rem *<description>                   *
 rem *<author>                        *
 rem *<contact info>                  *
 rem *<license>                       *
 rem **********************************

   set kernel multisprite

        set smartbranching on

                                  dim _P1_L_R = player1x.a
                                  dim _P1_U_D = player1y.b
                                  dim _P0_L_R = player0x.c
                                  dim _P0_U_D = player0y.d
                                  dim _P2_L_R = player0x.i
                                  dim _P2_U_D = player0y.j
                                  dim _player0a = e
                                  dim _player0b = f

 player1x = 110 : player1y = 70
 player2x = 130 : player2y = 20
 player3x = 30 : player3y = 20
 player4x = 30 : player4y = 70
 player0x = 50 : player0y = 50
 missile0x = 200 : missile0y = 200

   AUDV0=0
   AUDV1=0

BATTLEFIELD

  g=g+1
  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if g = 10 then player0:
        %00000000
        %00000000
        %00000000
        %11111111
        %11111111
        %00000000
        %00000000
        %00000000
end

  if g = 20 then player0:
        %00000000
        %00000000
        %11111111
        %00000000
        %00000000
        %11111111
        %00000000
        %00000000
end

  if g = 30 then player0:
        %00000000
        %11111111
        %00000000
        %00000000
        %00000000
        %00000000
        %11111111
        %00000000
end

  if g = 40 then player0:
        %11111111
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %00000000
        %11111111
end

 if g = 50 then player0:
        %00100100
        %00100100
        %00011000
        %00011000
        %01111110
        %00000000
        %00011000
        %00011000
end

   player1:
        %00001000
        %00000000
        %01011101
        %01011101
        %00011100
        %01100011
        %00011100
        %00011100
end

   player2:
        %00001000
        %00000000
        %01011101
        %01011101
        %00011100
        %01100011
        %00011100
        %00011100
end

   player3:
        %00001000
        %00000000
        %01011101
        %01011101
        %00011100
        %01100011
        %00011100
        %00011100
end

   player4:
        %00001000
        %00000000
        %01011101
        %01011101
        %00011100
        %01100011
        %00011100
        %00011100
end

 _COLUP1 = $0E

 COLUP2 = $40

 COLUP3 = $D4

 COLUP4 = $64

 COLUP0 = $1E

 COLUPF = $0E



 playfield:
 ................
 ................
 ................
 ................
 ................
 XXXXXXXXXXXXXXXX
 X...............
 X...............
 X...............
 X...............
 XXXXXXXXXXXXXXXX
end




 scorecolor = $0E

 drawscreen

        if g > 50 && joy0right then _P0_L_R = _P0_L_R + 0.30
        if g > 50 && joy0left then _P0_L_R = _P0_L_R - 0.30
        if g > 50 && joy0up then _P0_U_D = _P0_U_D + 0.30
        if g > 40 && joy0down then _P0_U_D = _P0_U_D - 0.30

 if _P1_L_R < _P0_L_R then _P1_L_R = _P1_L_R + 0.10
 if _P1_L_R > _P0_L_R then _P1_L_R = _P1_L_R - 0.10
 if _P1_U_D < _P0_U_D then _P1_U_D = _P1_U_D + 0.10
 if _P1_U_D > _P0_U_D then _P1_U_D = _P1_U_D - 0.10

 if _P2_L_R < _P0_L_R then _P2_L_R = _P2_L_R + 0.10
 if _P2_L_R > _P0_L_R then _P2_L_R = _P2_L_R - 0.10
 if _P2_U_D < _P0_U_D then _P2_U_D = _P2_U_D + 0.10
 if _P2_U_D > _P0_U_D then _P2_U_D = _P2_U_D - 0.10

 if joy0left && joy0fire then missile0x=player0x : missile0y = player0y : goto MISSILELEFT


 if collision(missile0, player1) && missile0x = player1x then n = 11: player1y = 255 : score = score + 10

 if collision(missile0, player1) && missile0x = player2x then n = 11: player2y = 255 : score = score + 10

 if collision(missile0, player1) && missile0y = player3y then n = 11: player3y = 255 : score = score + 10

 if collision(missile0, player1) && missile0y = player4y then n = 11: player4y = 255 : score = score + 10

   if n > 0 then AUDV0 = 15 : AUDC0 = 8 : AUDF0 = 20 : n = n - 1: if n = 0 then AUDV0 = 0

 if collision(missile0,playfield) then missile0x = 255 : missile0y = 255


MISSILELEFT
 missile0x = missile0x - 1

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