Discuss Scratch

OtherAsriel
Scratcher
100+ posts

How to reverse moving in scratch or record x position or y position?

So I saw a thing about this earlier in the year and thought this is not for my project it's useless but now when I think about it it is useful but I forgot the video name so I'm posting right here. If you want me to explain so right here.
Let's say I'm moving with the arrow keys regularly.. but then I want to go back to my previous position. How would I do that? It has to record at all times. Bonus question: Are orange bones still broken?
ggenije
Scratcher
500+ posts

How to reverse moving in scratch or record x position or y position?

No it has to record only previous position.
OtherAsriel
Scratcher
100+ posts

How to reverse moving in scratch or record x position or y position?

ggenije wrote:

No it has to record only previous position.
How?
ggenije
Scratcher
500+ posts

How to reverse moving in scratch or record x position or y position?

when green flag clicked
forever
set [prevX v] to (x position)
set [prevY v] to (y position)
your movement::custom
if <your condition::operators> then
go to x: (prevX) y: (prevY)
end
end
Cricket_Productions
Scratcher
17 posts

How to reverse moving in scratch or record x position or y position?

To record x and y positions make a list. You need a list “x” and a list “y”. and “old y” So:

when green flag clicked
repeat until <done>
add (x position) to [x v]
add (y position) to [y v]

To go to previous positions make 2 variables called “old x”. But when you add this script add this when you need it. For example if you broadcast “end” Then start this script with "When I receive end
set [old x v] to (x position)
set [old x v] to (x position)
Tell me if this helps!
Byron_Inc
Scratcher
1000+ posts

How to reverse moving in scratch or record x position or y position?

OtherAsriel wrote:

So I saw a thing about this earlier in the year and thought this is not for my project it's useless but now when I think about it it is useful but I forgot the video name so I'm posting right here. If you want me to explain so right here.
Let's say I'm moving with the arrow keys regularly.. but then I want to go back to my previous position. How would I do that? It has to record at all times. Bonus question: Are orange bones still broken?
I think this code will help:
when gf clicked
set [counter v] to (0)
repeat until <mouse down> // just until you want to reverse action
add (x position) to [x pos v]
add (y position) to [y pos v]
add (direction) to [direction v]
end
repeat until <(counter) = (length of [x pos v] :: list)>
go to x: ((item (length of [x pos v] :: list) of [x pos v]) - (counter)) y: ((item (length of [y pos v] :: list) of [y pos v]) - (counter)) :: motion stack
point in direction ((item (length of [direction v] :: list) - (counter)) of [direction v])
change [counter v] by (1)
end
I hope it worked.

Last edited by Byron_Inc (June 17, 2020 03:36:54)

jettypumpkin07
Scratcher
1000+ posts

How to reverse moving in scratch or record x position or y position?

What do you mean by “Are orange bones still broken?”
Monna-Uka
Scratcher
1000+ posts

How to reverse moving in scratch or record x position or y position?

jettypumpkin07 wrote:

What do you mean by “Are orange bones still broken?”
They tried to implement the orange bone attack to their Undertale game/level/project. I think they are mentioning it.
Also, here is the player's code for orange bones:
something above... ::events hat
if <touching [orange bones v]?> then
if <not<<<key [v v] pressed?> or <key [^ v] pressed?>> or <<key [> v] pressed?> or <key [< v] pressed?>>>> then
change [hp v] by [-1] //basically if the player doesn't move
OtherAsriel
Scratcher
100+ posts

How to reverse moving in scratch or record x position or y position?

Monna-Uka wrote:

jettypumpkin07 wrote:

What do you mean by “Are orange bones still broken?”
They tried to implement the orange bone attack to their Undertale game/level/project. I think they are mentioning it.
Also, here is the player's code for orange bones:
something above... ::events hat
if <touching [orange bones v]?> then
if <not<<<key [v v] pressed?> or <key [^ v] pressed?>> or <<key [> v] pressed?> or <key [< v] pressed?>>>> then
change [hp v] by [-1] //basically if the player doesn't move
I know how to do a orange bone now, the thing I wasn't doing wasn't IN the clone's sprite in the block when I start as a clone, or was it?
Monna-Uka
Scratcher
1000+ posts

How to reverse moving in scratch or record x position or y position?

OtherAsriel wrote:

I know how to do a orange bone now, the thing I wasn't doing wasn't IN the clone's sprite in the block when I start as a clone, or was it?
Umm, what?

Powered by DjangoBB