This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
crpl:docs:distance [2015/03/19 17:52] – discussion kill warren | crpl:docs:distance [2019/02/27 01:18] – [Distance] added example Karsten75 | ||
---|---|---|---|
Line 9: | Line 9: | ||
Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack. | Calculates the distance between two map points (x1,y1) to (x2,y2) and pushes the resulting floating point number to the stack. | ||
=== Examples === | === Examples === | ||
- | < | + | < |
+ | |||
+ | # terrain modification script to build a circular pyramid | ||
+ | |||
+ | 50 -> centerX | ||
+ | 50 -> centerY | ||
+ | 20 -> height | ||
+ | |||
+ | do (<- height add(1) <-height mul(-1)) | ||
+ | do (< | ||
+ | < | ||
+ | < | ||
+ | distance( <-x <-y <-height sub(< | ||
+ | loop | ||
+ | loop | ||
+ | </ | ||