Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. 知识库
  3. 二维积木
  4. x坐标、y坐标

x坐标、y坐标

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creaticodeteacher2-mail
    wrote on last edited by admin
    #1

    介绍

    当我们添加一个角色,我们常常需要告诉计算机把它放在哪里。如果我们只说“把小狗放到右上角”,那就有太多位置:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/4687b143-5ce9-40e1-b6a2-058e8ae8d563.png" width="500" style="border-radius: 5px; border: 1px solid #29622d;">

     
    为了使位置更精确,我们可以用“x坐标”告诉计算机角色左右有多远。x坐标介于-240和240之间:

    • 若x坐标为240,角色的中心就在舞台右边缘;
    • 若x坐标为 -240,角色的中心就在舞台左边缘;
    • 若x坐标为0,角色的中心就在舞台中央。

    我们可以用舞台下方的输入框试试不同的x坐标。注意,红点是角色的中心。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5477bfc8-7f00-4f75-85f6-27cc0890377a.gif" width="500" style="border-radius: 5px; border: 1px solid #29622d;">

     
    同理,我们可以用“y坐标”指定角色的位置多高、多低,y坐标介于-180和180之间:

    • 若y坐标为180,角色的中心就在舞台上边缘;
    • 若y坐标为 -180,角色的中心就在舞台下边缘;
    • 若y坐标为0,角色的中心就在舞台垂直方向的中心。

    同样可以用舞台下方的输入框试试不同的y坐标。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/af158926-6abe-4f0e-ae25-622f884eeb19.gif" width="500" style="border-radius: 5px; border: 1px solid #29622d;">

     

    “XY网格”背景

    为了帮助大家找到对应的坐标值,可以用一个背景叫做“XY网格”:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/92274f30-77d4-4d3f-b5e2-281d5b554ebb.png" width="800" style="border-radius: 5px; border: 1px solid #29622d;">

    网格包含2条交叉的线,交叉点在舞台中心,x坐标、y坐标都为0。橘黄色的线是x轴,蓝色的线是y轴。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/4e45a259-267c-454b-b1c2-29c7ae3966e4.png" width="500" style="">

     

    积木:“将x设为( )”

    若要把角色移到某一x坐标,可以用运动类别的积木“将x设为( )”。舞台下方的x坐标也会随之改变以反映变化结果。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/67a207a3-d408-4625-a602-1b5524846bc3.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">

     

    积木:“将y设为( )”

    同理,你可以用积木“将y设为( )”把角色移到任意的y坐标。注意,当你更改角色的y坐标,其x坐标不受影响。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/99fcb271-b6b8-4fe6-8ff2-dd8f7ba91fc2.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">

     

    积木:“移到x: ( ) y: ( )”

    你还可以同时设置x坐标和y坐标,就是用积木“移到x: ( ) y: ( )”。其结果与“将x设为( )”加“将y设为( )”运行的结果相同。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c76785b7-5e9c-446b-8697-0791f9ec325d.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">

     

    积木:“在( )秒内滑行到x: ( ) y: ( )”

    当你移动角色时,还可以用积木“在( )秒内滑行到x: ( ) y: ( )”制作动画。有一个额外的输入值让你指定角色移动多长时间。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ca479083-b136-4456-9010-6bd1c175c86d.gif" width="760" style="border-radius: 5px; border: 1px solid #29622d;">

     

    读取“x坐标”和“y坐标”

    如果你需要找出角色的x坐标和y坐标,可以用以下2个报表积木。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f328c1d6-4250-47bc-90ba-0ad1f05ea807.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode