Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Mouse X and Mouse Y

    2D Blocks
    1
    1
    857
    Loading More Posts
    • 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.
    • info-creaticode
      CreatiCode last edited by admin

      Introduction

      You can use these 2 reporter blocks in the sensing category to get the current position of the mouse pointer:

       

      As discussed in this article, the x position on the stage is always between -240 and 240, and the y position on the stage is always between -180 and 180.

      3cb12307-022d-43a5-a4b0-9427f70dd1d5-image.png

       
      When you click on the “mouse x” block in the code editor, since the mouse has already past the left edge of the stage, the value will be the lower bound of the stage, which is -240:

      p.gif

       
       

      Say the Mouse Position Repeatedly

      You can use the following code to say the mouse position repeatedly in a forever loop:

      p.gif

      1 Reply Last reply Reply Quote 0
      • First post
        Last post