This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-04-09 12:25:19

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

mouseX and mouseY

Hello! I had an idea for 2 reporter blocks that would allow you to define the Mouse X and Y.
So I looked in Scratch-UI-Panes - ScratchFrameMorph - other. There was the code for the little mouseX and mouseY thing in the corner of the project viewer thing.
But the code was only this:

Code:

^ workPane mouseX

And

Code:

^ workPane mouseY

I suppose that means its using something called "workPane" that doesn't exist in the 'block code' area, because when I use it and try to except, it asks me to define it.

So, any help?

Offline

 

#2 2011-04-09 12:32:45

wcfs96
New Scratcher
Registered: 2011-03-10
Posts: 37

Re: mouseX and mouseY

workPane in ScratchFrameMorph is a variable that is for the ScratchStageMorph (the stage). If you try using it outside the ScratchFrameMorph class you're going to get an error. You're going to have to see if the "block code area" has a reference to ScratchFrameMorph which you can then get workPane. Or the "block code area" already has a reference to workPane, I haven't really looked though.

Offline

 

#3 2011-04-09 12:58:29

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

wcfs96 wrote:

workPane in ScratchFrameMorph is a variable that is for the ScratchStageMorph (the stage). If you try using it outside the ScratchFrameMorph class you're going to get an error. You're going to have to see if the "block code area" has a reference to ScratchFrameMorph which you can then get workPane. Or the "block code area" already has a reference to workPane, I haven't really looked though.

Okay.  big_smile

How do you reference?

Last edited by ProgrammingFreak (2011-04-09 13:04:18)

Offline

 

#4 2011-04-09 13:10:07

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: mouseX and mouseY

I do believe workPane is the stage... this means that there's no need to access anything, just look in the stage for these two methods. they'll have a bunch of code which is (hopefully) transportable outside that class.

Offline

 

#5 2011-04-09 13:14:48

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

LS97 wrote:

I do believe workPane is the stage... this means that there's no need to access anything, just look in the stage for these two methods. they'll have a bunch of code which is (hopefully) transportable outside that class.

Okay! Thank you!  big_smile


In the stage in UI-Panes?

Last edited by ProgrammingFreak (2011-04-09 13:15:23)

Offline

 

#6 2011-04-09 13:16:40

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: mouseX and mouseY

ProgrammingFreak wrote:

LS97 wrote:

I do believe workPane is the stage... this means that there's no need to access anything, just look in the stage for these two methods. they'll have a bunch of code which is (hopefully) transportable outside that class.

Okay! Thank you!  big_smile


In the stage in UI-Panes?

roll
The ScratchStageMorph

Offline

 

#7 2011-04-09 13:17:55

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

LS97 wrote:

ProgrammingFreak wrote:

LS97 wrote:

I do believe workPane is the stage... this means that there's no need to access anything, just look in the stage for these two methods. they'll have a bunch of code which is (hopefully) transportable outside that class.

Okay! Thank you!  big_smile


In the stage in UI-Panes?

roll
The ScratchStageMorph

Oh. Lol. In Objects, yes. *blush*

Offline

 

#8 2011-04-09 13:20:13

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

Are the <x position> and <y position> blocks for the sprite or mouse?

Offline

 

#9 2011-04-09 13:22:17

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

Oh no. I just remembered. Sensing already has a block like this!  yikes

<mouse x><mouse y>

Offline

 

#10 2011-04-09 13:23:43

wcfs96
New Scratcher
Registered: 2011-03-10
Posts: 37

Re: mouseX and mouseY

x position & y position are for the sprite coordinates. mouse x & mouse y are for the mouse coordinates  smile  What class are you trying to reference the stage from?

Offline

 

#11 2011-04-09 13:25:23

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

wcfs96 wrote:

x position & y position are for the sprite coordinates. mouse x & mouse y are for the mouse coordinates  smile  What class are you trying to reference the stage from?

Doesn't matter now, does it?

Offline

 

#12 2011-04-09 13:38:46

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: mouseX and mouseY

ProgrammingFreak wrote:

LS97 wrote:

I do believe workPane is the stage... this means that there's no need to access anything, just look in the stage for these two methods. they'll have a bunch of code which is (hopefully) transportable outside that class.

Okay! Thank you!  big_smile


In the stage in UI-Panes?

Somewhere in there. I cannot find it, I thought it was presenter, but it isn't. Oh, okay, its under ScriptableScratchMorph,  tongue  silly us. LOL


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#13 2011-04-09 13:47:49

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: mouseX and mouseY

ProgrammingFreak wrote:

Oh no. I just remembered. Sensing already has a block like this!  yikes

<mouse x><mouse y>

Oh... I thought you were making a separate block! LOL


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#14 2011-04-09 14:46:23

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: mouseX and mouseY

ProgrammingFreak wrote:

Oh no. I just remembered. Sensing already has a block like this!  yikes

<mouse x><mouse y>[/blocks]

LOL. I was wondering what this was for.  tongue

Offline

 

#15 2011-04-10 18:31:15

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: mouseX and mouseY

Yeah. I was wanting to but it doesn't matter.

Offline

 

Board footer