Discuss Scratch

BobaFett-66
Scratcher
54 posts

[Point Towards] Block not working!

While I was making a new arcade game, I used these blocks:
when green flag clicked 
forever
point towards [mouse pointer v]
end

but it did not work, the sprite just kept facing in one direction! I tried everything that I thought would change this but there is still no progress!
PLEASE HELP!!!

@BobaFett-66

Last edited by BobaFett-66 (July 12, 2016 07:35:24)

asivi
Scratcher
1000+ posts

[Point Towards] Block not working!

BobaFett-66 wrote:

While I was making a new arcade game, I used these blocks:
when green flag clicked 
forever
point towards [mouse pointer v]
end

but it did not work, the sprite just kept facing in one direction! I tried everything that I thought would change this but there is still no progress!
PLEASE HELP!!!

@BobaFett-66
If you have tried everything, please, share the project.

Last edited by asivi (July 12, 2016 09:04:45)

Scratch-Minion
Scratcher
1000+ posts

[Point Towards] Block not working!

It worked perfectly for me.
Three things to check:
i) You have clicked the green flag to start the forever loop
ii) ** This script is inside the sprite that you want to turn towards the mouse pointer **
iii) The sprite is Showing (ie. you are not looking at another sprite) and it is on the stage.
TheLogFather
Scratcher
1000+ posts

[Point Towards] Block not working!

Do you have the sprite's rotation style set to “don't rotate”?

You can change it in two ways… one is with the “set rotation style” block, the other is by clicking on the little “i” symbol to the top-left of the sprite in the sprites pane, and then choosing the rotation style with the circular arrow symbol.


BobaFett-66
Scratcher
54 posts

[Point Towards] Block not working!

Im so sorry but your helpfulness and advice is not working!!!!!!
Ill send you a link of the project here: https://scratch.mit.edu/projects/115927626/

LP_Play
Scratcher
1000+ posts

[Point Towards] Block not working!

when green flag clicked
move (10) steps
forever
point towards [mouse-pointer v]
end
You wont need the set rotation block, just set to all-around on sprite, and save, and bam.
SkyClan480
Scratcher
100+ posts

[Point Towards] Block not working!

I made it work!!!!!!!!!!!!!!!! Select the paint tool under New Sprite. Leave it blank. The new sprite will be Sprite2. Select Sprite2, and add this script:
when green flag clicked
forever
go to [mouse pointer v]
end
Then change your arrow script to this:
when green flag clicked
forever
point towards [Sprite2 v]
move (10) steps
end

Last edited by SkyClan480 (July 12, 2016 14:29:57)

TheLogFather
Scratcher
1000+ posts

[Point Towards] Block not working!

The problem is that there is somehow something wrong with your “point towards mouse-pointer” block.

If you go to its drop-down menu and choose “mouse-pointer” again then it will all work fine.


Technical stuff…

I'm not sure how it got into the state it has, but it appears that it has the text “mouse-pointer” as the internal state for that menu choice, rather than what it should be, which is the code “_mouse_” (which is what Scratch uses internally to mean that you chose “mouse-pointer” from the menu).

Looking at the JSON, your project has this for the script:
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "mouse-pointer"]]]]]],

What it should be is this (note the bit after “pointTowards”):
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "_mouse_"]]]]]],

It's an easy fix, since choosing “mouse-pointer” again from the menu will set it to what it's meant to be.

Last edited by TheLogFather (July 12, 2016 15:49:36)

Jackzack
Scratcher
100+ posts

[Point Towards] Block not working!

I made it look like it stops and then goes to it by takeing all your code out and inserting this
when green flag clicked
forever
go to [mouse pointer v]
wait (0.1) secs
end
asivi
Scratcher
1000+ posts

[Point Towards] Block not working!

TheLogFather wrote:

The problem is that there is somehow something wrong with your “point towards mouse-pointer” block.

If you go to its drop-down menu and choose “mouse-pointer” again then it will all work fine.


Technical stuff…

I'm not sure how it got into the state it has, but it appears that it has the text “mouse-pointer” as the internal state for that menu choice, rather than what it should be, which is the code “_mouse_” (which is what Scratch uses internally to mean that you chose “mouse-pointer” from the menu).

Looking at the JSON, your project has this for the script:
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "mouse-pointer"]]]]]],

What it should be is this (note the bit after “pointTowards”):
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "_mouse_"]]]]]],

It's an easy fix, since choosing “mouse-pointer” again from the menu will set it to what it's meant to be.

Gotcha?
SkyClan480
Scratcher
100+ posts

[Point Towards] Block not working!

TheLogFather wrote:

The problem is that there is somehow something wrong with your “point towards mouse-pointer” block.

If you go to its drop-down menu and choose “mouse-pointer” again then it will all work fine.


Technical stuff…

I'm not sure how it got into the state it has, but it appears that it has the text “mouse-pointer” as the internal state for that menu choice, rather than what it should be, which is the code “_mouse_” (which is what Scratch uses internally to mean that you chose “mouse-pointer” from the menu).

Looking at the JSON, your project has this for the script:
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "mouse-pointer"]]]]]],

What it should be is this (note the bit after “pointTowards”):
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "_mouse_"]]]]]],

It's an easy fix, since choosing “mouse-pointer” again from the menu will set it to what it's meant to be.


That might work, but my idea is foolproof.
asivi
Scratcher
1000+ posts

[Point Towards] Block not working!


SkyClan480 wrote:

asivi wrote:

TheLogFather wrote:

The problem is that there is somehow something wrong with your “point towards mouse-pointer” block.

If you go to its drop-down menu and choose “mouse-pointer” again then it will all work fine.


Technical stuff…

I'm not sure how it got into the state it has, but it appears that it has the text “mouse-pointer” as the internal state for that menu choice, rather than what it should be, which is the code “_mouse_” (which is what Scratch uses internally to mean that you chose “mouse-pointer” from the menu).

Looking at the JSON, your project has this for the script:
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "mouse-pointer"]]]]]],
What it should be is this (note the bit after “pointTowards”):
 ["doForever", [["forward:", 10], ["setRotationStyle", "all around"], ["pointTowards:", "_mouse_"]]]]]],

It's an easy fix, since choosing “mouse-pointer” again from the menu will set it to what it's meant to be.

Gotcha?
That might work, but my idea is foolproof.
True, true, yours works fine!

Last edited by asivi (July 12, 2016 18:06:25)

BobaFett-66
Scratcher
54 posts

[Point Towards] Block not working!

Thanks for that guys! I really appreciate your help! Ill follow all you guys!

when green flag clicked
forever
if <<(user) = [BobaFett-66]>> then
say [WOOO!!!!!]

end
end
TheLogFather
Scratcher
1000+ posts

[Point Towards] Block not working!

SkyClan480 wrote:

That might work, but my idea is foolproof.
Yeah, that'll work perfectly fine for this case – though it does use an extra sprite (unnecessarily), which could come back and cause trouble in certain cases if the project becomes more complex. Also, it doesn't get to the bottom of what was actually wrong with the project (which was nothing to do with the actual scripting, but was, somehow, a corrupted internal value for the menu entry of that “point towards” block).

Last edited by TheLogFather (July 13, 2016 14:30:47)

TheLogFather
Scratcher
1000+ posts

[Point Towards] Block not working!

I've realised what the problem is here. It's actually a bug in Scratch.

If you drag the “point towards” block out from the block palette, then it has the internal setting of “mouse-pointer” rather than “_mouse_”. Since it shows that text (“mouse-pointer”) as its current value, it only *looks* like it is correctly set.

Since it isn't the correct value internally, it means it will not work unless you choose something from its drop-down menu (e.g. choose “mouse-pointer” ‘again’) to set up the internal value correctly.

The bug was introduced here: https://github.com/LLK/scratch-flash/pull/1119

I've logged this on Scratch's github issue tracker: https://github.com/LLK/scratch-flash/issues/1166

Last edited by TheLogFather (July 14, 2016 15:07:59)

benjaminpants
Scratcher
65 posts

[Point Towards] Block not working!

TheLogFather wrote:

I've realised what the problem is here. It's actually a bug in Scratch.

If you drag the “point towards” block out from the block palette, then it has the internal setting of “mouse-pointer” rather than “_mouse_”. Since it shows that text (“mouse-pointer”) as its current value, it only *looks* like it is correctly set.

Since it isn't the correct value internally, it means it will not work unless you choose something from its drop-down menu (e.g. choose “mouse-pointer” ‘again’) to set up the internal value correctly.

The bug was introduced here: https://github.com/LLK/scratch-flash/pull/1119

I've logged this on Scratch's github issue tracker: https://github.com/LLK/scratch-flash/issues/1166

Thank you! I finnaly fixed my issue! THANKS MAN
jpatel8282
Scratcher
1 post

[Point Towards] Block not working!

The point towards block is still broken for my project
TheAnomalousPseudo
Scratcher
1000+ posts

[Point Towards] Block not working!

jpatel8282 wrote:

The point towards block is still broken for my project
Please make your own topic, that way it's much more likely for your question to be answered.

Powered by DjangoBB