Jump to content

Photo

Collision detection with a scrolling playfield


19 replies to this topic

#1 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • 11,670 posts
  • Location:Salem, Oregon

Posted Thu Feb 14, 2019 6:19 AM

This is driving me crazy. I have this code that works fine when it's not scrolling, but when it is scrolling, the guy can move through the playfield (he's not supposed to.) I spent hours and hours trying to get it to work but to no avail. The area I'm working on starts at line 444 and goes to the end. Variable p controls the timer for the scrolling and variable q controls when to move the bar up.

 

Attached Files



#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Thu Feb 14, 2019 8:15 PM

I'll try to look at it tonight if nobody else does. My sister had to take her father to the emergency room last night and I'll have to help her with random things tonight so she can go back to the hospital. I'll probably be free to look at the program in around 3 to 4 hours.



#3 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 12:05 AM

I'm looking at the code now. I see that you're using some low temp variables. If scrolling uses them, they could be getting corrupted. Do you think that might have anything to do with it? I'll keep looking in case that's not the problem.



#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 1:07 AM

Right now I know what f, k, p, q are for. Can you post the rest of the variables you use in alphabetical order and say what they do?

 

Example:

 

a = Counter for cat juggler animation.

b = Remembers how many monkeys were eaten by rabid goat.

c = Counter for alien tickle fight IN SPACE.



#5 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 5:11 AM

See if this is acting the way you want it to:

 

Attached File  wwm15_2019y_02m_15d_0557t.bin   8KB   9 downloads



#6 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Fri Feb 15, 2019 5:24 AM

That's a little better, but when the guy is below the bar and near it, it acts weird and jerky.

 

s - bar height

m - bar space middle (used to determine how big the bar space is)

n -  bar space ending

o - lives counter

x & y, l{0} - collision detection

v - REFP0

a-d, h, i - canoe paddling guy animation


Edited by atari2600land, Fri Feb 15, 2019 5:24 AM.


#7 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 5:33 AM

That's a little better, but when the guy is below the bar and near it, it acts weird and jerky.
 
s - bar height
m - bar space middle (used to determine how big the bar space is)
n -  bar space ending
o - lives counter
x & y, l{0} - collision detection
v - REFP0
a-d, h, i - canoe paddling guy animation


Maybe I can slap in a check of playfieldpos or something. I have to go eat, but then I'll come back and see what I can do.



#8 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 8:54 AM

See if this is better:

 

Attached File  wwm15_2019y_02m_15d_0953t.bin   8KB   10 downloads



#9 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Fri Feb 15, 2019 4:52 PM

That's better, but when the guy is below the bar and moves horizontally closer to the hole, he stops until the bar is farther away.



#10 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Fri Feb 15, 2019 5:02 PM

That's better, but when the guy is below the bar and moves horizontally closer to the hole, he stops until the bar is farther away.


I'll play with the code some more and see if there's anything I can do.



#11 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sat Feb 16, 2019 5:07 AM

The collision prevention that keeps the canoe from sticking on top of the bar was seeing the bottom of the bar as though it was lower because it was, it just hadn't scrolled out of the row area yet. Once the last bit of the bar scrolls out of the way, too much time has gone by, so it looks like the sprite is hitting against nothing. After yanking out some code and putting a little in, it seems to be working better than the previous versions:

 

Attached File  wwm15_2019y_02m_16d_0551t.bin   8KB   10 downloads



#12 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Sat Feb 16, 2019 5:29 AM

If you get up near the top and hold up, the guy goes through the bar.



#13 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sat Feb 16, 2019 6:20 AM

If you get up near the top and hold up, the guy goes through the bar.

 

Thanks. That shouldn't be a difficult fix.



#14 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Sat Feb 16, 2019 7:29 AM

I think I did it myself. Let me know if any bugs pop up.

 

Attached Files



#15 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sat Feb 16, 2019 2:40 PM

I think I did it myself. Let me know if any bugs pop up.

 

 

The problem with that one is that the guy sticks to the bar as if it's covered with glue, broken glass, and rusty nails. I'll adjust the one I was working on and post it.



#16 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sat Feb 16, 2019 3:18 PM

The variable x is free to use now. The variable y was free until I used bit 7 of it. You can move that bit to r (since you are only using bit 0 and bit 1, but you won't be able to use r = 0 like you have in the program. Once you move bit 7 of y to r, the variable y will be free to use.

 

Seems like you have a lot of redundant collision checks. You might be able to combine some of them and save cycles. I started making variable aliases so I could tell exactly what is going on, but I didn't have all of the variable information, so it's unfinished.

 

Attached File  wwm15_2019y_02m_16d_1602t.bin   8KB   11 downloads

 

Attached File  wwm15_2019y_02m_16d_1602t.bas   21.89KB   9 downloads



#17 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Sat Feb 16, 2019 6:23 PM

If the canoe hits the playfield in the gap, then the canoe goes up. Is there a way to stop this?



#18 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sat Feb 16, 2019 7:29 PM

If the canoe hits the playfield in the gap, then the canoe goes up. Is there a way to stop this?

 

Probably. The scrolling changes everything so putting out one fire causes three more. I can see what I can do in 3 or 4 hours.



#19 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sun Feb 17, 2019 1:11 AM

If the canoe hits the playfield in the gap, then the canoe goes up. Is there a way to stop this?

 

I tried a few things, but it made other things worse. As it is now, players can press diagonally down (left or right) and the canoe won't stick to the bar as they make their way to the opening. If players want to go under the bar and rub their heads against it for some some strange reason, they can do that too. If players shove against the sides of the gap, there is a chance that they will get sucked up into the eddy behind the bar. Sounds like a feature, not a bug. Instead of trying to fix it, you might want to embrace it.



#20 atari2600land OFFLINE  

atari2600land

    Channel F Viewer

  • Topic Starter
  • 11,670 posts
  • Location:Salem, Oregon

Posted Sun Feb 17, 2019 5:39 AM

I worked on this for a few more hours. As a result, things look drastically different. Why? Because of the playfield. I wanted it to give me a different hole, but the bottom kept showing up in a height of 1 pixel before reverting to the correct hole placement. So I decided to make the pfcolor be blue to hide this fact. That made the ends flicker, so I decided to use missile 1 for the boundary ends. Which meant that the guy no longer was in a boat because if I used the ball for a boat, it would flicker too.

 

So this is a level where the guy fell out of the kayak and the tide is sweeping him away. Which is fine because it looked silly with him paddling while the tide is sweeping him away.

And a few times I kept getting this weird bug where part of the screen was green. Don't know why. And since the pfblocks were scrolling, that meant that the title screen's pfpixel's y locations were all screwed up when the guy died. I fixed this as well.

Attached Files






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users