Author Topic: Turning Corners  (Read 12806 times)

0 Members and 1 Guest are viewing this topic.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #20 on: April 16, 2012 »
Sorry Raizor, i think we posted at the same time, change depth from 32 to 16 and see
Thanks

Yep, that's sorted it, thanks. Will take a look at the code later today and try and figure out the lines issue.
raizor

Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #21 on: April 16, 2012 »
Pot Noodle,

I've attached a RAR file with an updated version of the source.

I changed it to run in a window as it was taking about 20 seconds to start and stop the program each time. If this wasn't a problem for you or you don't like it, just paste the code from my version into yours.

To be honest, you almost had it sussed. I've basically done something very similar to what you where doing to scale the center grey lines - for the dashed lines at the left and right:

      ; middle grey lines
      LineXY(CurrentX+(#LineWidth-Distance*0.04),ScreenLine,CurrentX+(#LineWidth+Distance*0.04),ScreenLine,LineColor)
     
      ; left dashed lines
      LineXY(CurrentX-Distance-((#LineWidth-Distance*0.16)), ScreenLine, CurrentX-Distance, ScreenLine,SideColor)
     
      ; right dashed lines
      LineXY(CurrentX+Distance,ScreenLine,CurrentX+Distance+((#LineWidth-Distance*0.16)),ScreenLine,SideColor)

For the left lines, we offset the start position of the line by an amount calculated using your Distance variable which lets us know how far down the screen (Y pos) we are. We do the same for the right side too, but offset the end position of the line instead of the start position.

You can change the thickness/scale of the lines by changing the 0.16 values above.

As you progress with this, you might want to work out those offsets in advance as you're performing the same multiplications a few times at present. It probably doesn't matter too much, but if you add more code and it starts to slow down, give it some thought. As your screen height stays the same, you could also pre-calculate a table or two with the various values and use that as a lookup table to get the best performance.

Once again, I learned a bit more about Pure Basic while doing this, so all good :)

Hope it helps and does what you want.

Cheers,

Joe

EDIT: Would help it I attached the file :P
raizor

Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #22 on: April 16, 2012 »
Also, this is worth a look. Not sure how useful the code will be to you, but you might be able to deduce some tricks.
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Turning Corners
« Reply #23 on: April 16, 2012 »
Brill thanks Raizor  :clap: I had thought of a window insted of full screen but was to busy trying to sort the lines out.
Now i can consentrate on the bends  ::)
Thanks again for all your help.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #24 on: April 16, 2012 »
No worries Pot Noodle. Looking forward to seeing the bends :)
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Turning Corners
« Reply #25 on: April 17, 2012 »
Raizor check out the curves and see if think it's OK may want tweaking..

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #26 on: April 17, 2012 »
Looking good :D

Only comment is that as the curves flips from one side to the other the movement starts off soft and then gets very hard toward the end of the transition. This might just be your test movement, but it looks a bit weird imho. Very cool curves though.
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Turning Corners
« Reply #27 on: April 19, 2012 »
Does anyone have any idea why the curves are so jumpy, i have tried everything i can think off
god this is a real pain, something to do with the ddx value but i can't sort it out.
 :'(

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #28 on: April 19, 2012 »
Are A, DX, DDX etc your own variable names? If so, you should probably give them names that reflect what they're used for. DistanceX and DistanceXIncrement or something like that. It helps make the code much easier to follow :)
raizor

Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Turning Corners
« Reply #29 on: April 19, 2012 »
Yes i know what you are saying the variable A is just a loop counter and as for DDX it holds a float value for shifting the lines X values & DX is used to increment DDX so it looks like this DX + DDX, this i think is where the problem is but i have changed it but to no avail.  :(

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: Turning Corners
« Reply #30 on: April 23, 2012 »
Hey Raizor,  Just to keep you up to date, the programme is looking good now I have had help from else where
But all is good and Thanks again for all your time and help, you were bang on with your ideas.  :clap:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: Turning Corners
« Reply #31 on: April 23, 2012 »
Great that you got it sorted Pot Noodle :)

Post another preview when you get time please, I'd be interested to see it.
raizor

Challenge Trophies Won: