Computer Science Canada Tiles + Collision need help |
Author: | Rewrite [ Sat Jan 22, 2005 11:48 pm ] | ||
Post subject: | Tiles + Collision need help | ||
Hey short time reader, first time poster to these forums. I've recently picked up on turing and am currently compiling a game of my own. But being a newbie I've run into some problems that I was hoping some of the pros of this forum could help me out with. Like many NES games before I was hoping to create my game using the tile system. So far I've been successful in creating a program that takes in a txt file and converts it into tiles, and than a character that moves around on that screen and scales the map. Although my problem lies in the fact that I cannot figure out how collision would work, so if someone could provide some insite onto the subject I would greatly appreciate it ![]() Here is what I have worked on as of now. (heres to hoping the code html works)
|
Author: | Tony [ Sun Jan 23, 2005 12:11 am ] |
Post subject: | |
it is quite simple. you just have to validate move procedures. Let me explain: first you move your character vertually. Such as calcualte the new position your character will move to and save that to a temp variable. You then check the tile type that is in that location. If it's something you don't want your character to walk on (water, wall, etc), your validation returns false and you don't move the character. |
Author: | Rewrite [ Sun Jan 23, 2005 4:59 pm ] |
Post subject: | |
Thanks, I can understand the whole theory behind tiles and why it works. But what I'm having trouble with is Pic.Draw files colliding with other Pic.Draw files. I've seen plently of tutorials on Draw.Boxs or whatever colliding with each other, but not Pic.Draws and bmps hitting each other, and I don't know about this 'whatdotcolor' system, but I doubt it would work properly for multicolor tiles (if stone steps and stonewalls of a bmp are the same grey how does turing know how to collid with the stonegrey wall and not the stonegrey ground?) |
Author: | TheXploder [ Sun Jan 23, 2005 5:16 pm ] | ||
Post subject: | |||
Whatdot colour will not work for sure. Now the concept with tiles is to make a 2d array and for each 0 in the 2d array place a grass tile lets say and for a 1 a wall. So the spacing of the tiles doesn't matter, what matters is where the object is located on the map. 2 is the players location.. 1111 1201 1001 1001 1111 so then to make a check...
|