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
code:
if x>maxx then
x:=x
end if
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
Sponsor Sponsor
AsianSensation
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.
Tony
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.
Posted: Sun Nov 23, 2003 9:25 am Post subject: (No subject)
hmm.. that is a good idea, and I understand the concept but how exactly would you make it work for example can you create this wall detection idea on this box
code:
drawfillbox (1,1,300,300,black)
I learn more easily if I have a basic guide thanks
Dan
Posted: Sun Nov 23, 2003 2:10 pm Post subject: (No subject)
if whatdotcolor(x,y) = black then
code for what to do when hit wall
end if
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!
Andy
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
Tony
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 6:51 pm Post subject: (No subject)
no.. it wouldnt flicker, offscreenonly man, draw it on the offscreen, check it, and clear the offscreen, and make it nooffscreenonly
Sponsor Sponsor
thoughtful
Posted: Sun Nov 23, 2003 6:57 pm Post subject: (No subject)
i dont know but i think dodge way might even be faster than yours tony, because writing to an array of maxx * maxy takes some time, where as whatdotcolor rocks!
Andy
Posted: Sun Nov 23, 2003 6:58 pm Post subject: (No subject)
you've learned well my young padawan... pss, use it on the ccc jr 5 sr 3
Tony
Posted: Sun Nov 23, 2003 6:59 pm Post subject: (No subject)
heh. Why dont you try it out?
time it takes for whatdotcolor * number of times executed in game vs. how long it takes to load the 2D array with map info.
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
Andy
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!
thoughtful
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
AsianSensation
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.