locked
How to center userdefined image for LDShapes.SetTurtleImage RRS feed

  • Question

  • Sample see: WMN903

    Turtle hotspot is always on (8,8) or (7,7) of the image for every image size. This fits well for default TurtleSize (16x16) but not for any other square size eg. 24,32,48 etc. in LDShapes.SetTurtleImage(Image, TurtleSize).

    How can i center a userdefined image of any given square size and any selected TurtleSize, so that it will be centered at the Turtle hotspot (16/2, 16/2) ??

    Thanks

    Saturday, January 25, 2014 6:09 PM
    Answerer

Answers

  • The way turtle movement and rotation is handled by SmallBasicLibrary needs to overwritten in extension that causes turtle size to change - this is a bug in extension - hopefully fixed in upload.  Thanks for reporting it.
    Saturday, January 25, 2014 7:02 PM

All replies

  • The way turtle movement and rotation is handled by SmallBasicLibrary needs to overwritten in extension that causes turtle size to change - this is a bug in extension - hopefully fixed in upload.  Thanks for reporting it.
    Saturday, January 25, 2014 7:02 PM
  • Thanks LitDev for fastest correction. Looks like all works perfect now.

    Here's latest german LitDev.De.xml  (v. v1.0.0.97).

    Saturday, January 25, 2014 9:21 PM
    Answerer
  • Easy fix - thanks again for the de translation.
    Saturday, January 25, 2014 9:25 PM
  • As an after-thought, the turtle is actually an image shape with name "_turtle" (only real difference is the move is based on center not top/left corner - hence the previous problem), you can actually zoom or do other shapes methods on it like:

    Shapes.SetOpacity("_turtle",50)
    Shapes.Zoom("_turtle",2,2)
    Shapes.Rotate("_turtle",90)
    Shapes.Move("_turtle",X,Y)
    The turtle trails are also just line shapes with names like "_turtleline1" etc.
    Saturday, January 25, 2014 11:41 PM
  • These are great and useful notes and additional 'Turtle features' (SetOpacity and Zoom) !!

    Further remarkable:

    - Turtle and Turtle-Lines lies on top of all other layers like GWBG, (Line- and filled) Drawings, Controls, Shapes

    - TurtleLines are adjustable with PenColor/-Width.

    - Conversion  from  Turtle.Speed [Value 1-10]  to  AnimTime [ms/Pxl]:
    is   Math.Abs(Distance[Pxl] * 320 / (Turtle.Speed * Turtle.Speed))

    so eg. for a straight Distance of 100 Pxl at a Turtle.Speed of 5 (default):

    100 * 320/(5*5) -> 1280 ms/100Pxl

    Speed   Durat [ms/100Pxl]   Praxis (PenDown    PenUp)

    10            5                          59                             53
    9           395                       429                           429
    8          500                        525                           522
    7          653                        661                           665
    6          888                        934                           889
    5          1280                      1313                         1304
    4          2000                      2021                         2014   :-)
    3          3555                      3561                         3593
    2          8000                      8015                         8038
    1          32000                    32028                       32016


    Sunday, January 26, 2014 2:50 PM
    Answerer