locked
Turtle Background RRS feed

  • Question

  • Is there any way of adding a background picture with the turtle window in Small Basic.

    I am trying to put a map of the world in the background then use the turtle to show a path taken across the world.

    Thursday, May 9, 2019 9:30 AM

Answers

  • i myself has not done it but you can put world map or part of it as png image on the net with a image name and download it to your small basic window by the name you gave the image as shown by Pappa Lapub as above i dont know but i hope i have made some sense i myself am a student of small basic forum learning Code programing small basic                                                                                                  mahreen miangul
    Thursday, May 9, 2019 2:52 PM

All replies

  • For a background image you would simply use

    GraphicsWindow.DrawImage(imageName, x, y)    or

    GraphicsWindow.DrawResizedImage(imageName, x, y, width, height)

    eg.

    ' 'https://commons.wikimedia.org/w/index.php?search=equirectangular+earth+projection
    gw = GraphicsWindow.Width
    gh = GraphicsWindow.Height
    img = ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Worldmap_location_NED_50m.svg/1024px-Worldmap_location_NED_50m.svg.png")
    GraphicsWindow.DrawResizedImage(img, 0,0, gw,gh)
    
    GraphicsWindow.PenColor = "Red" ' Line color
    
    ' Random walk
    While "True"
      x = Math.GetRandomNumber(gw)-1
      y = Math.GetRandomNumber(gh)-1
      Turtle.MoveTo(x,y)
      Program.Delay(1000)
    EndWhile

    To change the TurtleImage itself, you can use

    LDShapes.SetTurtleImage(imageName, size)

    • Proposed as answer by litdev Thursday, May 9, 2019 2:21 PM
    Thursday, May 9, 2019 1:33 PM
    Answerer
  • i myself has not done it but you can put world map or part of it as png image on the net with a image name and download it to your small basic window by the name you gave the image as shown by Pappa Lapub as above i dont know but i hope i have made some sense i myself am a student of small basic forum learning Code programing small basic                                                                                                  mahreen miangul
    Thursday, May 9, 2019 2:52 PM