BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Transparent increment"
, by thechange
Formula for calculating a natural increment from A to B no matter if positive or negative.
Code
; Calculating the incremental value to get from A to B. ; Whether A is higher, lower or equal to B doesn't matter. ; Using IFs is faster but this is done with just maths. x1 = +5 ; Starting value x2 = -5 ; Ending value xi = (((x2>x1)+1)*2)-3 ; Increment x = x1 Repeat Print x x = x + xi Until (x=x2+xi) Or (x1=x2) WaitKey End
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations