Posted: Sat Nov 22, 2003 7:14 pm Post subject: adaptable wall detection
So far the only method that I know of for wall detection was using
if x>maxx then
I was trying to experiment with whatdotcolor and such but it is a bit too cumbersome. can someone help me create a wall detector that is adaptable to all diffect shapes (so if I change the shape of the room it will still detect if a wall is there.) thanks
Posted: Sat Nov 22, 2003 8:20 pm Post subject: (No subject)
waits patiently for dodge to explain all the merits of whatdotcolor...
ok, nvm, he didn't show up, oh well, I'll explain it.
using edge detection with irregular shapes could be very hard, so therefore, we use wahtdotcolor, it's one of the best way turing could handle these kind of situations.
whatdotcolor would work under simple conditions, where there are like 3 different colors or something, but it will make your program as slow as hell.
if the edge you are trying to detect isn't so irregular, meaning that there exist some kind of equation for that shape, then you can use math for edge detection in that situation.
Posted: Sat Nov 22, 2003 8:57 pm Post subject: (No subject)
seeing as you want edge detection for rooms, I assume you're writing a game of sords. The best way to go would be to create a 2D array holding positions of walls, and basically use tileset aproach towards movement.
in other words, before your character makes the move from one tile to the next, it first checks if that spot allows movement - such as it is not a wall.
When moving from a room to room, you just reload your map array with new values of walls, other objects and what not.
if whatdotcolor(x,y) = black then
code for what to do when hit wall
where x and y is the loaction of the object that could hit the wall
NOTE: where "black" is you may have to replace with the num eqelivent of the color.
Computer Science CanadaHelp with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Posted: Sun Nov 23, 2003 3:25 pm Post subject: (No subject)
HEY! juss cuz i took a day off, you guys stealing my job of teaching the secrete arts of whatdotcolor? azn ur dead... lol
ok, if u want to edge detection, use only one color for each type of object, then mask a good picture over that with ur desired patterns, so when you're checking collision detection, check on the simple one, then apply the change to both pictures, and voila! the smrter way to detect collision
Posted: Sun Nov 23, 2003 6:07 pm Post subject: (No subject)
exsept that it would suck to have the screen flicker with weird colors each time you check for collision.
You're better off drawing your simple template onto a vertual buffer - create array 1..maxx, 1..maxy and draw your pixels onto it. This way you check color values (which represent different objects) in an array rether then visualizing the same values onto the screen.
Posted: Sun Nov 23, 2003 7:04 pm Post subject: (No subject)
Oh you meant to load it jus at the start or after every move?
becuase you were talking about the flickering last time i thought you meant loading it every time the program executes. Loading it just one time wouldn't take that long, but in faster games, where one needs collision detection of irregular objects very often whatdotcolor will be better
Posted: Sun Nov 23, 2003 7:07 pm Post subject: (No subject)
efficency is for losers... in a couple of years, we're all gonna be running turing on comps with clock speeds of a cople of yodahertz, so why learn the efficent way? learn the fun way!
Posted: Sun Nov 23, 2003 7:14 pm Post subject: (No subject)
True bro, i mean when i did some of those font effects, also they were slow but after that i just love what dot color and i go to trouble just trying to invlolve it in all my programs some how . It is the only fun thing to use in turing for me so far . I wish i find some more soon though
Posted: Sun Nov 23, 2003 7:27 pm Post subject: (No subject)
dodge you drug dealer! getting innocent people hooked onto that whatdotcolor stuff, shame on you!
next thing you know, compsci would be banning the use of whatdotcolor, but then again, like marijuanna, we are going to legalize it in the end anyways.