I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Hi!
I've tried many methods to draw NON-antialiased lines (it's for collision detection), but none of them work! I mean, they do, but only if "X > Y" or something...
and I can't figure out how to make it work under any conditions, like VB's function (look at my other post on the midpoint algorythm - that's a very fast algorythm so I would prefer it, but anything will have to do!).
Can someone please help me on this? Any piece of code will help!
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
Yeah, that must be really weird, maybe the user is the one that has to detect the collision by looking at the line and see if it hits something...
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
1. Hardware: The parts of a computer system that can be kicked.
2. f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.
3. Bad command or file name. Go stand in the corner.
4. Never trust a computer you can't throw out the window.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Well... if you really wanna know: I want it for a 2-d line of sight system. I need to cast rays from each of the lights and when it finds an obstacle it stops...
Does anyone know how to make a line?
I've seen Fox's example, it's cool but it only works under some conditions.
I looked at the midpoint algorythm, it has the same problem.
I tried to make on myself, and it STILL had the same problem!
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
How about you get a pencil, some paper, and a ruler, and you start from one end of the ruler, and draw aaaaaall the way to the ot-...What? Visual Basic? Oh! Nevermind! Heheh....eeeheheh.. <;)
"Curiosity killed the cat, but he still has eight lives left."
- Xyanth
"The only stupid question is the question never asked."
- Xyanth
It's C but easily converted to VB. This is the best known line drawing algorithm. There are better ones for special circumstances, but I doubt they'd all be easily implemented in VB.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Thanks! The pice of code I had from Brensenham's algorythm was incomplete, this one works
Do you think storing the brightness values of each tile surrounding each light in seperate variables would be good? Or should I store only the start and end points of each light?
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
Dim slope as long
Dim startx as long
Dim starty as long
Dim xlen as long
xlen=500
Line1.x1=startx
Line1.y1=starty
Line1.x2=xlen
Line1.y2=(slope*xlen)+Line1.y1
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Thanks Schnarf, but I was trying to do it without controls. Thanks anyway!
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
whats a starting point of a light? and what's a ending point then?
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
It has details on a new way to make lights.
It's in C++ but since it doesn't have any code, converting it to VB shouldn't be a problem!
My idea would be to, instead of storing the start and end points of each ray, to store the brightness values of each point of the light, like an image, to make it faster. What do you think?
Also, the original idea was to use this for Line of Sight. It can easily be changed to Lights... I don't think I have to explain too much on this
Last edited by Jotaf98; Mar 4th, 2001 at 05:19 PM.
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
on that link, well i have almost no idea what youre talking about, sorry
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."