Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Object Collision NEED HELP!!!!!!!!!

Author
Message
NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 4th May 2003 13:17
i have a ball. I want to find out if this ball has hit another object. I used the code:
blockhit = object hit(2,0)
blockhit is my variable.
But as there are over 100 blocks to check through it is very slow and jerky, can anyone think of a way to check if it has hit another object? It is breakout by the way.
Nick
Gubinz
22
Years of Service
User Offline
Joined: 3rd May 2003
Location: United Kingdom
Posted: 4th May 2003 14:04
What you will probably have to do is store the IDs of all blocks that can be hit into an array, then just check the blocks in the array.
As blocks are removed, you will have to modify the array or generate a new array.
Not sure if this will give you any speed increase.

Have you thought of using sprites instead?

All the Best,
Gubinz

NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 4th May 2003 14:12
i tried a for loop to check all the blocks, it is still quite slow, i was thinking along the lines of only checking the blocks if it is above a certain point. That would make it fast, but then suddenly slow! thnx anyway. I wanted to make it 3D looking.
Nick
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 4th May 2003 14:18
I don`t get what you are trying to do, the code you list gives you the number of the block you hit, why would you want to run the test 100 times over???, maybe a better description of the problem would help.

Mentor.

NachoMan
22
Years of Service
User Offline
Joined: 14th Apr 2003
Location: United Kingdom
Posted: 4th May 2003 14:38
3D breakout, i am doing a test to find out if the ball has hit an object, and then what object it has hit. To do that I used that test. However, this was too slow because there are 100 blocks, hence the test would repeat 100 times. I am trying to find a way to do this which would make the game faster.
Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 4th May 2003 16:15
in the tutorials which are in the DB manual they use a differnt type of collision called 'maths collision' this is much faster than standard collision. It is in the bit where they check if th bullet is hitting the monster. Check It Out !

[age 11]

Login to post a reply

Server time is: 2025-05-17 03:19:17
Your offset time is: 2025-05-17 03:19:17