Videopac / Odyssey2 forum
November 12, 2019, 07:59:08 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Al lot of attachments from Nov 2011 till april 2012 are damaged. Please ask the original poster to re-upload if you need them.
 
   Home   arcade Help Login Register links videopac.nl  
Pages: [1]   Go Down
  Print  
Author Topic: check collisions for 2 sprites  (Read 1261 times)
sokoban
Trying to get the cartridge in...
*
Posts: 17



ghismart ghisloban ghisloban
WWW
« on: June 02, 2017, 09:08:02 PM »

Hello!

Based on Soeren's examples, I easily understand how to check collision for sprite 0.
It even works perfectly, I tested it.
But I can't figure out how to check collisions for both sprite 0 and sprite 1 on each frame.

Cry

Is it possible ?
Or I have to check collisions for sprite 0 one frame of two and for sprite 1 on other frame of two ?
For the moment, I use something more or less like this algo version for sprite 0 :

call waitsync
call vdcenable
tell the vdc to check collisions for sprite 0
call gfxoff
read collision register whitch reflects sprite 0 situation
call gfxon

I tried some tricks to do the same for sprite 1 on same frame (before new call waitsync) but none of them work...
Can you help me? Thanks.

See you later!
Logged
Rene_G7400
Moderator
I take the Videopac and leave the Canoli!
*****
Posts: 2519



WWW
« Reply #1 on: June 03, 2017, 09:26:59 PM »

The collision information is gathered while the screen in being drawn, so when you initialise the collision register at the start of a frame, the collision information will be available at the end of the frame. The VDC uses the same register to gather the collision infomation as the register that you use to initialise the collision detection (VDC register A2). The Vsync BIOS routine then copies this info to intram 3D. I think it should be possible to check the collisions for both sprite 0 and 1, but then you won't be able to see which of these sprites actually had a collision. Your idea to check the collisions of sprite 0 in one frame and sprite 1 in the next should work. Otherwise you might have to use collision detection by calculation (if possible in your situation) : calculate the difference between the position of a sprite and the position of the object(s) that you want to check collisions with.
Logged
sokoban
Trying to get the cartridge in...
*
Posts: 17



ghismart ghisloban ghisloban
WWW
« Reply #2 on: June 03, 2017, 09:46:46 PM »

Thank you Rene_G7400. Cool

In fact, this morning, I tried the solution of checking the collisions of sprite 0 in one frame and sprite 1 in the next frame. This works fine.
I also though about using collision detection by calculation as you mentioned. In my case, it could be a good idea, yes.

Now I just have to choose between these 2 methods. Tongue
Bye and see you later with a working small game. Wink
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!