• Welcome to Dark Bit Factory & Gravity.
 

Turning Corners

Started by Pot Noodle, April 10, 2012

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Raizor

Quote from: Pot Noodle 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:

Raizor

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:

Raizor

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:

Pot Noodle

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.

Raizor

No worries Pot Noodle. Looking forward to seeing the bends :)
raizor

Challenge Trophies Won:

Pot Noodle

Raizor check out the curves and see if think it's OK may want tweaking..

Raizor

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:

Pot Noodle

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.
:'(

Raizor

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:

Pot Noodle

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.  :(

Pot Noodle

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:

Raizor

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: