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

#1 2012-03-22 18:17:42

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

This is why this block is needed

This block has been discussed many times:

Point at x() y()
This has been put down though many times because you can place a sprite at that point and have it point at the sprite. However, what you can't do with a sprite is this:
Point at x (pick random (30) to (90)) y (pick random (-40) to (60))
I can't think of a way to do this wih a hidden sprite, and even if you could, I think this block is still needed.

Last edited by turkey3 (2012-03-22 18:19:08)

Offline

 

#2 2012-03-22 18:20:40

Luke121
Scratcher
Registered: 2008-07-14
Posts: 1000+

Re: This is why this block is needed

If it's been discussed so much, there is no need for another topic discussing it.


http://bit.ly/IlVuB5
Sorry PF, too lazy to make my own!  tongue

Offline

 

#3 2012-03-22 18:37:57

MrMonk999
Scratcher
Registered: 2011-12-17
Posts: 500+

Re: This is why this block is needed

When gf clicked
point towards [Sprite2 v]//on other sprite
When gf clicked
hide
go to x: (pick random (30) to (90)) y: (pick random (-40) to (60))//on hidden sprite

Last edited by MrMonk999 (2012-03-22 18:39:25)


http://i.imgur.com/CAMJe.png

Offline

 

#4 2012-03-22 18:40:19

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: This is why this block is needed

Another easy way to replicate it is to get a normal, one pixel big sprite, and go like this

when gf clicked
wait until <<point to wherever>=[1]>
go to x:<pick random (30) to (90)>y:<pick random (-40) to (60)
broadcast [point v]
When I receive [point v]
point towards [the sprite above v]

Offline

 

#5 2012-03-22 19:20:08

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: This is why this block is needed

The above method wouldn't work for 1s1s games though.

We desperately need that block, I have to use an extremely long workaround now :l


Why

Offline

 

#6 2012-03-23 12:31:58

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: This is why this block is needed

there is a way to do it using trig

when i receive [point v]
if <(y position) = (target y)>
  if <(x position) > (target x)>
    point in direction (90)
  else
    point in direction (-90)
  end
  stop script
end
if <(y position) < (target y)>
  point in direction (([atan v] of (((x position)-(target x))/((y position)-(target y))))-(180))
else
  point in direction ([atan v] of (((x position)-(target x))/((y position)-(target y))))
If it doesn't work swap round the x's and y's

Last edited by joefarebrother (2012-03-23 12:55:30)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#7 2012-03-23 12:44:50

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: This is why this block is needed

joefarebrother wrote:

there is a way to do it using trig

Yep, here.


Why

Offline

 

#8 2012-03-23 17:09:22

Haiming
Scratcher
Registered: 2011-08-20
Posts: 1000+

Re: This is why this block is needed

I don't think this thread is needed...

Offline

 

Board footer