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.

2D All the way! / non-sprite collision

Author
Message
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 27th Mar 2007 04:32
i have been searching everywhere... how do i make a collision with this type of code:

thank you for your help... btw... i am using DBC

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 27th Mar 2007 05:06
It can be done, but the question is 'Wouldn't it be easier to use sprites?' Otherwise you would have to take care of the copying/pasting screen images (or perhaps clearing the entire screen in every interation of your main loop -- not very efficient), tracking if the two have intersected, etc.

You could do this with memblocks also, but for what you have listed, it seems like a lot more work.

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 27th Mar 2007 23:53
ok... i don't really understand memblocks though... how do they work?

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 28th Mar 2007 02:02
hpfan273 - I'm not recommending (at all) that you use memblocks for what it appears you are doing. It is possible to do it, but the work would be considerably more than simply using sprites. If you want to learn about memblocks the following is a link to Tutorial City, which has some tuts on memblocks:
http://members.thegamecreators.com/tutorialcity/html/darkbasic_professional.html

Memblocks access video memory directly and are more work than sprites. They are great for some applications because they are FAST and if you have to move a couple of thousand stars (dots), for example, they work great.

Do you need help with making/moving/colliding/etc. sprites?

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 28th Mar 2007 04:09
i have issues with collision for sprites... but otherwize no...

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 28th Mar 2007 05:59
You're not the first to have issues with sprite collisions in DBC or with DBP. If you do a search for 'collision' in the forum, you will find many others have had similar problems. I got to the place to where I write my own routine to check for mathematical collisions. It's not pixel perfect, but it has been adequate and reliable for me.

If you want, post the code that you have and I will see if I can help you with using sprites/collisions with it. Maybe others will help too.

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 30th Mar 2007 01:15
here is my code:

the level 2 part is just to tell me if i hit it or not... thank you soo much for your help

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 30th Mar 2007 02:42 Edited at: 30th Mar 2007 02:45
Could you post the bitmap files, too?

[EDIT] Also, could you briefly describe what you intend to do in the program?

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 31st Mar 2007 06:46
the objective of this game is to not touch the walls of each of the tracks... the tracks will get harder as you go along... and each time you make it through the 4 tracks... an enemy is added... here are the files...

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 31st Mar 2007 15:32
I see the difficulty you are having as DBC collision commands do not work at all. I'll have to work on it a little bit to see what I can do. In the code, if the player does touch the track it goes to level 2. Do you want it to maybe flash the screen or something and go back to level 1 after the flash?

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 31st Mar 2007 20:20
yea... like... make the cursor go back to it's original spot... thanx so much

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 1st Apr 2007 01:39
Your track does not move and the DBC sprite collision just won't work. It will have to be done another way, but it does not seem needful that your track be a sprite, only the ball. It will take a little time to try to figure this one out.

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 1st Apr 2007 02:34
ok... i'll also keep trying... thanx for ur help

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 1st Apr 2007 15:59
The difficulty comes from the mouse being used to move the ball. The player could zip the mouse quickly and move right out of the track quite easily. To me, it seems like you will have to do a mathematical check on the track to see if the ball has touched the sides or gone beyond the edge of the track. You could also limit the movement of the mouse, but I tried this and the program is so slow that it's not very fun or challenging.

In order to do a mathematical check, either straight lines, rectangles or squares would be needed and you would have to hard code all of the boundary data. You would have to re-tool track 3 and track 4 so that the lines are straight.

It is up to you. If you want to pursue this, I'm game. Perhaps a fellow coder has another idea, but this is what I can see.

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 1st Apr 2007 21:35
what if i made the track sprite bigger... like... so that the green covers the whole screen... and there is a little black spot for the mouse to move?

Why do they turn against me? Especially when i need them the most?
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 1st Apr 2007 23:25 Edited at: 1st Apr 2007 23:26
I was playing around with this and one of the weirdest things took place. With the green, DBC's sprite hit won't pick up the collision between sprites 1 & 2. However, if you put a couple of rows of white instead of the green, it works. Try it and see if it does the same for you.

You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 2nd Apr 2007 05:11
yea... it does... thats weird... lol XD...awsome new discovery...

Why do they turn against me? Especially when i need them the most?

Login to post a reply

Server time is: 2026-07-04 22:44:23
Your offset time is: 2026-07-04 22:44:23