Results 1 to 14 of 14

Thread: Looks like NO ONE knows how to draw a SIMPLE line!

  1. #1

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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

    Unhappy

    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!

    Thanks!
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Why do you need a line for collision detection?

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  4. #4
    Lively Member *Super Sniper*'s Avatar
    Join Date
    Jan 2000
    Location
    Portland, OR
    Posts
    81
    sounds like he wants the user to be able to see where the limit is, but I am not sure what he wants...
    Website

    Send an e-mail to [email protected] to get a sample of my games.

    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.

  5. #5

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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!

    Please help! I'm really desperate!
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

  6. #6
    New Member
    Join Date
    Jan 2001
    Posts
    14

    I know!

    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

  7. #7
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    http://www.sanctuary.org/~ashe/coding/breshanham.html

    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.
    Harry.

    "From one thing, know ten thousand things."

  8. #8

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

  9. #9
    Member
    Join Date
    Oct 2000
    Posts
    33
    Code:
    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

  10. #10

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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!
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  12. #12

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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... here's the article:

    http://www.gamedev.net/reference/art...article729.asp

    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.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

  13. #13
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    ERROR: The requested URL could not be retrieved

    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.

  14. #14

    Thread Starter
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    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
    Heh, it's outdated

    Here it is as a TXT.
    Attached Files Attached Files
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    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."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width