Four-way Gravitational Engine Issues (Atari 2600)

107 views Asked by At

In the last couple months I've been working on a project using "Fake Gravity Platformer Test with Shooting" (from here: http://atariage.com/forums/topic/179473-fake-gravity-platformer-test/) as a template.

The goal of my project is to create a Platformer with four-way gravity.

This is how the Code is supposed to work: First, it is decided which Code should be executed depending on the current gravity, then every direction of Collision is represented by a Subroutine.

Each of those Subroutines follow the same scheme: The Code tests if one pixel collides with the block and then tests for another one in the same row/column (depending on which direction and which gravity)

This is supposed to create a glichless "Hitbox" for the player character.

This sadly doesn't work for a reason unknown to me (The player can jump through walls or glitch his "head" halfway into a block supposed to be solid)

I've tried many methods to fix this issue:

  • Make the Player Coords normal values instead of float, hoping it would help, but it didn't

  • Tried different PlayerCoords-to-Block-Value conversions like division, modulo and bitwise

  • Change Order of Subroutines

I'm clueless and I've completely run out of ideas.

Does anyone know what the Problem could be?

I attached the current state of my project: https://pastebin.com/NbD4Huvi
a

(P. S. Visual Batari Basic v1.0 Build 568 used to work, I don't know if anyone uses this language anymore or I'm the only one, I already posted this on the Atari 2600's Programming Forum for Newbies, but haven't recieved an answer in two weeks.)

1

There are 1 answers

0
Eduardo Fabricio On

I got a similar issue, atari has a very limited power of processing, specially using bank switching.

In my case the problem was with joystick movements that position the sprite beyond the limits of playfield blocks and batari collision function seems process with a delay =P

So I found this workaround that cancel movement considering the offset of player width and height.

Let's see the trick:

; Playfield collision
  
   ;***************************************************************
   ;
   ;  Joy0 up check.
   ;
   ;```````````````````````````````````````````````````````````````
   ;  Skips this section if joystick isn't moved up.
   ;
   if !joy0up then goto __Skip_Joy0_Up
   ;if player1y <= _P_Edge_Top then goto __Skip_Joy0_Up
   temp5 = (player1x-10)/4
   temp6 = (player1y-15)/8
   if temp5 < 34 then if pfread(temp5,temp6) then goto __Skip_Joy0_Up
   temp4 = (player1x-17)/4
   if temp4 < 34 then if pfread(temp4,temp6) then goto __Skip_Joy0_Up
   temp3 = temp5 - 1
   if temp3 < 34 then if pfread(temp3,temp6) then goto __Skip_Joy0_Up
   p1posy=p1posy-0.2

__Skip_Joy0_Up

   ;***************************************************************
   ;
   ;  Joy0 down check.
   ;
   ;```````````````````````````````````````````````````````````````
   ;  Skips this section if joystick isn't moved down.
   ;
   if !joy0down then goto __Skip_Joy0_Down
   ;if player1y >= _P_Edge_Bottom then goto __Skip_Joy0_Down
   temp5 = (player1x-10)/4
   temp6 = (player1y+2)/8
   if temp5 < 34 then if pfread(temp5,temp6) then goto __Skip_Joy0_Down
   temp4 = (player1x-17)/4
   if temp4 < 34 then if pfread(temp4,temp6) then goto __Skip_Joy0_Down
   temp3 = temp5 - 1
   if temp3 < 34 then if pfread(temp3,temp6) then goto __Skip_Joy0_Down
   p1posy=p1posy+0.2

__Skip_Joy0_Down

   ;***************************************************************
   ;
   ;  Joy0 left check.
   ;
   ;```````````````````````````````````````````````````````````````
   ;  Skips this section if joystick isn't moved to the left.
   ;
   if !joy0left then goto __Skip_Joy0_Left
   ;if player1x <= _P_Edge_Left then goto __Skip_Joy0_Left
   temp5 = (player1y-1)/8
   temp6 = (player1x-18)/4
   if temp6 < 34 then if pfread(temp6,temp5) then goto __Skip_Joy0_Left
   temp3 = (player1y-8)/8
   if temp6 < 34 then if pfread(temp6,temp3) then goto __Skip_Joy0_Left
   p1posx=p1posx-0.2

__Skip_Joy0_Left

   ;***************************************************************
   ;
   ;  Joy0 right check.
   ;
   ;```````````````````````````````````````````````````````````````
   ;  Skips this section if joystick isn't moved to the right.
   ;
   if !joy0right then goto __Skip_Joy0_Right
   temp5 = (player1y-1)/8
   temp6 = (player1x-9)/4
   if temp6 < 34 then if pfread(temp6,temp5) then goto __Skip_Joy0_Right
   temp3 = (player1y-8)/8
   if temp6 < 34 then if pfread(temp6,temp3) then goto __Skip_Joy0_Right
   p1posx=p1posx+0.2

__Skip_Joy0_Right