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

#1 2010-07-30 10:14:42

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Help! Positioniong Problem!

So, I'm putting a sprite's previous positions in 2 lists, X and Y. I want it to end if you walk on one of the same pixels again, how would I do this quickly?


http://i46.tinypic.com/dw7zft.png

Offline

 

#2 2010-07-30 10:27:58

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Help! Positioniong Problem!

When Flag Clicked
forever
| if <not <Last X contains (x pos)> and <Last Y contains (y pos)>>
| |add (x pos) to list (Last X)
| |add (y pos) to list (Last Y)
| else _________________________________________________________
| stop all
| _____________________________________________________________
|______________________________________________________________

Last edited by johnnydean1 (2010-07-30 10:33:12)


You can now reach me on Twitter @johnnydean1_

Offline

 

#3 2010-07-30 10:33:34

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Help! Positioniong Problem!

But what if you are on 65, 34, and you have been on 65, 10, and 10, 34. It wouldn't allow you.


http://i46.tinypic.com/dw7zft.png

Offline

 

#4 2010-07-30 10:34:20

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Help! Positioniong Problem!

Oh I can fix that!


You can now reach me on Twitter @johnnydean1_

Offline

 

#5 2010-07-30 10:35:19

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Help! Positioniong Problem!

Then do it.


http://i46.tinypic.com/dw7zft.png

Offline

 

#6 2010-07-30 10:43:55

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Help! Positioniong Problem!

When Flag Clicked
forever
| if < <Last X contains (x pos)> and <Last Y contains (y pos)> >
| set index to 0.
| repeat until < <index = (length of (x pos) ) > or < index = true > >
| change index by 1.
| if < <(item index of Last X) = (x pos) and <(item index of Last Y) = (y pos) > >
| set index to true.
|_______________________
| if index = true
| stop all.
| else
| add (x pos) to Last X.
| add (y pos) to Last Y.
|______________________
|_________________________________________________

Last edited by johnnydean1 (2010-07-30 10:44:11)


You can now reach me on Twitter @johnnydean1_

Offline

 

#7 2010-07-30 10:45:59

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Help! Positioniong Problem!

I need it to be FAST.


http://i46.tinypic.com/dw7zft.png

Offline

 

#8 2010-07-30 10:47:23

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Help! Positioniong Problem!

fine do it like this:


You can now reach me on Twitter @johnnydean1_

Offline

 

#9 2010-07-30 10:56:31

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Help! Positioniong Problem!

When Flag Clicked
forever
| set X to item 1 of Prev. X.
| set Y to item 1 of Prev. Y.
| if < <Last X contains (X)> and <Last Y contains (Y)> >
| set index to 0.
| repeat until < <index = (length of (Last X) ) > or < index = true > >
| change index by 1.
| if < <(item index of Last X) = (X) and <(item index of Last Y) = (Y) > >
| set index to true.
|_______________________
| if index = true
| stop all.
| else
| add (Y) to Last X.
| add (X) to Last Y.
|______________________
| wait until < not < (x pos) = (X) > and < (y pos) = (Y)>
| delete 1 of Prev.X
| delete 1 of Prev.Y
|_________________________________________________


When Flag Clicked
forever
| add (x pos) to Prev. X
| add (y pos) to Prev. Y
| wait until < not < < (item last of Prev. X) = (x pos) and < (item last of Prev.Y) = (y pos.)
____________________________

Last edited by johnnydean1 (2010-07-30 10:56:39)


You can now reach me on Twitter @johnnydean1_

Offline

 

#10 2010-07-30 10:58:09

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Help! Positioniong Problem!

O...Kay?


http://i46.tinypic.com/dw7zft.png

Offline

 

Board footer