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

#1 2011-02-21 16:13:22

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

"Point towards" block not working

In this project, there is a sprite (dart monkey direction finder) that finds the direction so the towers can point towards the balloons. The towers point in directions other than the balloons. Is the "point toward" block not working? I even tried the workaround in the Scratch Wiki. Can somebody please help me?

Here's an image of the script that's not working:
http://ashwin31415.webs.com/photos/a/b.gif

Last edited by lemonpretzel (2011-02-21 16:32:32)

Offline

 

#2 2011-02-21 16:57:58

scratch_yoshi
Scratcher
Registered: 2009-06-12
Posts: 1000+

Re: "Point towards" block not working

Aha! I see the problem... turn the costume of the monkey so that its head is pointed to the right. That should fix it.


Retired from Scratch, but just the language itself. Not the forums.

Offline

 

#3 2011-02-22 20:00:37

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: "Point towards" block not working

I tried that. http://scratch.mit.edu/projects/lemonpr … st/1614188 (It doesn't work in the new flash player). It works fine with one monkey, but with two monkeys it is like this:
http://ashwin31415.webs.com/photos/a/blah2.gif
I've noticed that the two monkey's directions are reversed; monkey one is pointing towards the direction monkey two should be pointing, and vice versa. I don't know how to fix it.
And when I put more than two monkeys:
http://ashwin31415.webs.com/photos/a/blah.gif
Total chaos!  yikes  Please tell me if you have a solution.

Also, the monkeys work by adding the x and y positions of the towers to lists. Then a separate sprite goes to the first tower and points toward a bloon. Then another sprite goes to the pointer sprite and points in its same direction. Then it erases the first stamp by stamping a green circle, and stamps the tower again. I think something is wrong with the code. Please help!

Offline

 

#4 2011-02-23 02:02:29

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: "Point towards" block not working

I just ran into this problem today in my Star Trek game.

The problem is that the Point Towards block accepts a variable, but that functionality only works in the development environment.  It does not work when uploaded to the web site.

The workaround that I did was to have a big nested IF ... ELSE block checking to see if

if < variable = Sprite1 >
| Point Toward Sprite1
else
| if <variable = Sprite2 >
| | Point Toward Sprite2
----------------------------------

etc.

I know it's ugly, but that was the only way I could get my project to work correctly when uploaded.  And, I really wanted my project to work right on the web site.  You get way more views that way.

Hope this helps you.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#5 2011-02-23 06:42:49

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: "Point towards" block not working

But it also doesn't work in the Scratch program. Even when I take out the variable and make it point to the bloon itself, it doesn't work. I'll try the workaround that you suggested.

Offline

 

#6 2011-02-27 08:47:27

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: "Point towards" block not working

Please! I need help!

Last edited by lemonpretzel (2011-03-04 18:47:01)

Offline

 

#7 2011-02-27 09:09:35

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: "Point towards" block not working

I see you're problem.

Variables can't be set to sprites, only the name of the sprites. Sprites can’t sense other sprites by just their name.

To fix it, I do not know.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#8 2011-02-27 14:56:11

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: "Point towards" block not working

The name of the sprite is "01", which is the variable.

Offline

 

#9 2011-02-27 15:12:40

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: "Point towards" block not working

As henley said, that unfortunately doesn't work.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2011-02-28 22:03:28

funnyman1120
Scratcher
Registered: 2008-07-31
Posts: 100+

Re: "Point towards" block not working

is the distance to farthest baloon higher than range when he is suppose to point? try moving the point towards in to the repeat until


Check out my website for updates on all your favorite games! Funnyman1120's Website

Offline

 

#11 2011-03-05 10:01:00

lemonpretzel
Scratcher
Registered: 2008-10-23
Posts: 100+

Re: "Point towards" block not working

Oh, I think you're right. I'll change the scripts.

Offline

 

Board footer