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! / Top Down Graphics and Collision (Need Help here)

Author
Message
Daikaze
20
Years of Service
User Offline
Joined: 18th Mar 2006
Location:
Posted: 21st Mar 2006 23:38
Greetings everyone,

Recently I decided to start on a project in Dark Basic. After finally deciding what type of project to go with I put some of it together.

I got the scrolling areas and such the way I like... but I recently ran into a dilemna. I can make the game without any real issues using NES style graphics (tile based, think NES Zelda). Of course these graphics don't appeal to me and I would like to basically upgrade the setup to SNES style graphics (think SNES Zelda).

The problem comes in with things such as overlapping sprites and collision detection.

Any advice on how to go about doing this?
Daikaze
20
Years of Service
User Offline
Joined: 18th Mar 2006
Location:
Posted: 22nd Mar 2006 07:19
So far I am thnking that using shadows to check for collision might work out. Since the players (and monsters) shadow will always match their feet they wont be able to walk onto wall sections or anything else that might be awkward since the shadows would collide first and stop the player from moving in that direction.

So to get this to work right I guess I would just need to make sure it draws the shadow and then the sprite to go with it. Will collision still be considered if part of the sprite is covered by another sprite?


Sorry about the double post. For some reason I couldnt edit.

Actually I have another question about transparency. I know that DB uses the color black for transparency (unless tunred off). Can it be changed to another color (say Pink)?
Avan Madisen
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 24th Mar 2006 22:56
I'd suggest using a simple 2d collision system, it's is actually quite simple to do.

Between individual characters in 2d you can easily get away with circle collision. Just work out the distance between them and if it's less then a sum of the radius' of both characters, shove them apart to that distance. It's a lot faster then the sprite collision and, believe it or not, it's how a lot commercial games do collision, even modern ones!

As for the transparency colour, it's been a while since I used it but there's a command, something like "set color key" that sets the colour to be used for transparency. I think it covers the whole system, so every sprite and 3d object will use it, don't hold me to that cause I'm not sure.

Don't look at me like that!
You're just jealous because the voices are talking to me!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 24th Mar 2006 23:49
All of those games use an array for collision.

Dim Map(Number of tiles X, Number Of Tiles Y)

You store values in there for whatever collision you want.
For example You store a 0, for no collision at all, or a 1 for a collision.

So you have X and Y which relate to positions on your screen. Now you can look in X and Y to see what is stored in there.


Data 0,0,0,0,0,1

Look above. You read that sort of data into the array. You have five zeros, so there is no collision for five image blocks. Image blocks can be any size. They are usually 32*32 pixels. So imagine the first five image blocks are images of a road that you can walk along.

The sixth part of the Data is a 1. Now as your player walks along the road starting at the first zero he walks 32 pixels before you look for the next zero, then you let him walk another 32 pixels before you check the next set of data. when he has walked 5 times 32 pixels he will walk into a 1. Now you stop him from walking.

Tapewormz
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 22nd Apr 2006 00:52
Isometric is the word you're looking for. Just for future reference.

It's also alot shorter than typing Top Down Graphics...

Login to post a reply

Server time is: 2026-07-04 15:04:12
Your offset time is: 2026-07-04 15:04:12