Archived

This topic is now archived and is closed to further replies.

Collision detection in Visual Basic, has anyone here achieved this?

This topic is 6603 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Depending on your purpose of programming I know two ways. Either you test collision coordinates (assuming it's 2D graphics) on a per pixel basis (mostly really slow in real time) or a rectangle collision test.

Ex.

1. Setup a scene with two bitmaps and keep track of their rectangles.

2. Check if the two rectangles intercepts eachother.

3. Perform action if they do

[This message has been edited by Spiff (edited November 14, 1999).]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What I honestly, truly need to know, is how I can prevent my character from entering certain regions of the form. Can this be done? If so, how?

I'm, once again, trying to make a game similar to Zelda 3. I need to do the same thing done in that game, you can walk anywhere except on bricks, rocks, enemies, and the like. Does anyone know how to do this? What conditions would I have to check for?

Share this post


Link to post
Share on other sites
I guess what we need to know from you is, how do you store the player's location and the map? If you store it as tiles, then simply marking tiles that the player should not be able to walk on should suffice. Otherwise, if the locations are in true X and Y coordinates, then you need to pursue collision detection.

- Splat

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well I'm using the image's left, and top properties for storing it's position.

Tell me though, how can I do tile map storage? Is it better than Left and Top properties? Are there any drawbacks?

Any help is appreciated.

Share this post


Link to post
Share on other sites
Well, assuming you are making a game that has a map larger than the size of the screen, and you can do with tile graphics and not one big bitmap, then yes, a tile system would work nice.

The trick to, at least in this case, is finding out what is and is not "walkable on". How do you / will you store this information. Obviously, the game needs to know this in order to restrict the players movement.

With a tile system, it is very simple. Before you move the player, check to see if the tile he is moving to is marked impassable. If it is, then don't move him!

On a side note, in addition to knowing the player's Top and Left you will need to keep track of the position of the upper-left corner of the displayed area relative to the upper-left of the world / level map. With those two bits you can know where any object is in the map.

- Splat

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok, is the tile system an advanced feature, like and API, or is it just a fancy name for checking if the user is allowed to enter a square?

And how would I know if the square/tile he is attempting to enter is impasssible, is it something predefined? Or what?

Share this post


Link to post
Share on other sites
Not to be snipy, but judging by the messages in this thread, I don't think that a Zelda type game is what you should start off with. A tile map is a semi-intermediate project which I suggest you read a lot of tutors on. The perfect game for you, I believe, would be a space invaders clone. then build up from there.

Would everyone agree on this?

Share this post


Link to post
Share on other sites
To me it seems like you don't even use BitBlt for graphics drawing and believe me,
I've been there, and in my opinion, Windows GDI is really bad for games programming use and I suggest you start reading DirectX tutorials, there are alot of them and it isn't that hard to create a 2D scrolling game.

Wish you all luck
_____
Spiff

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes I am using bitblt, I've just never created a game before. It's always difficult when you start something new.

I think I'll just keep doing what I'm doing. It's only a little hobby for me anyway, I'm not going into this professionally. Not yet anyway.

Trust me, I've got animation for my character while he walks, and he is confined to move within a certain area.

If I need more help, I'll be back.

Kay!

Share this post


Link to post
Share on other sites
Man, I've been trying for 2 days now, and I can only get it to work slightly well. I'm trying to make a game similar to Zelda 3, and I need to make it so the user can only walk in certain areas, and not on pots and stuff like that.

Can anyone give me a method that has worked well for them? Or some sample code...ANYTHING.

Share this post


Link to post
Share on other sites