I'm making a project, and I just want to know...
Is there a way to get the x and y position of ten sprites and put them all together in a code/variable and get it so when you enter the (code?), the 10 sprites change position to the coordinates in it? I know. Confusing. >.< I can't figure out how to.
I used BirdByte's scripts, but how can I make the second part?
Here's the link to the project. I need something to record the x and y position of each note sprite, and changes when their x and y position change.
Is it possible?
Last edited by humhumgames (2012-08-24 22:59:53)
Offline
I suppose you could average them all together... it would get awkward if some of them were in negative coordinates, though. I'll see if I can come up with a basic project that would show that.
EDIT: Here you go: http://scratch.mit.edu/projects/Scratcher456/2743323
Last edited by Scratcher456 (2012-08-23 12:57:23)
Offline
I don't think that will work... Averaging them won't help, because the sprites each go to their individual place, and the seperate x and y coordinates for each one should be intact.
I tried something, but it involved lots of variables (A variable for each coordinate XP), and I bet there's an easier way.
Last edited by humhumgames (2012-08-23 12:51:32)
Offline
humhumgames wrote:
I don't think that will work... Averaging them won't help, because the sprites each go to their individual place, and the seperate x and y coordinates for each one should be intact.
I tried something, but it involved lots of variables (A variable for each coordinate XP), and I bet there's an easier way.
Well, I DO have a 'decompiler/ recompiler' that allows you to store all of that data in two lists, one of 'X' values and one of 'Y' values. I could upload that if you wanted. I'll put a link in here if I can get something that works.
Offline
A list?
when gf clicked add <x position> to [co-ordinates list v] add <y position> to [co-ordinates list v]Do this for all 10 sprites.
Last edited by JH1010 (2012-08-23 13:03:18)
Offline
JH1010 wrote:
A list?
when gf clicked add <x position> to [co-ordinates list v] add <y position> to [co-ordinates list v]Do this for all 20 sprites.
That's about what I was thinking, except with a little added scripting so that you could edit the list.
Offline
10 sprites, and my sig changes automatically.
Anyways, what do you mean by added scripting?
Offline
Bump. Here's the link to the project. I need something to record the x and y position of each note sprite, and changes when their x and y position change.
Offline
You can use this script...
when gf clicked forever delete (all v) of [notex v] delete (all v) of [notey v] add ([x position v] of [note1 v]) to [notex v] add ([y position v] of [note1 v]) to [notey v] add ([x position v] of [note2 v]) to [notex v] add ([y position v] of [note2 v]) to [notey v] add ([x position v] of [note3 v]) to [notex v] add ([y position v] of [note3 v]) to [notey v] add ([x position v] of [note4 v]) to [notex v] add ([y position v] of [note4 v]) to [notey v] add ([x position v] of [note5 v]) to [notex v] add ([y position v] of [note5 v]) to [notey v] add ([x position v] of [note6 v]) to [notex v] add ([y position v] of [note6 v]) to [notey v] add ([x position v] of [note7 v]) to [notex v] add ([y position v] of [note7 v]) to [notey v] add ([x position v] of [note8 v]) to [notex v] add ([y position v] of [note8 v]) to [notey v] add ([x position v] of [note9 v]) to [notex v] add ([y position v] of [note9 v]) to [notey v] add ([x position v] of [note10 v]) to [notex v] add ([y position v] of [note10 v]) to [notey v] endThere you go!
Offline
*scripts are too long and complicated for me to fix and they look incorrect in visual mode. You'll have to quote this and read the text to try and understand what's going on. Sorry about that..
____________
How about:
delete [all v] of [list v] add (join ((abs ([x position v] of [note 1 v]))) ((abs ([y position v] of [note 1 v])) * (-1))) to [list v] if <(letter (1) of (x position)) = (-)> replace (item [last v] of [list v]) with (join (item [last v] of [list v]) (-)) else replace (item [last v] of [list v]) with (join (item [last v] of [list v]) (0)) end if <(letter (1) of (y position)) = (-)> replace (item [last v] of [list v]) with (join (item [last v] of [list v]) (-)) else replace (item [last v] of [list v]) with (join (item [last v] of [list v]) (0)) endThen to get the values back:
set [counter v] to (1) repeat (length of [list v]) set [letter v] to (1) repeat until <(letter (letter) of (item (counter) of [list v]) = (-)> set [x v] to (join (x) (letter (letter) of (item (counter) of [list v])) change [letter v] by (1) end change [letter v] by (1) repeat until <(letter) > (length of (item (counter) of [list v])) set [y v] to (join (y) (letter (letter) of (item (counter) of [list v]))) change [letter v] by (1) end end set [x v] to (join (letter (length of (item (counter) of [list v])) - (1))) (x)) set [y v] to (join (letter (length of (item (counter) of [list v])) - (0))) (x))Then set x and y to the x and y variables. This combines both x and y values in 1 item, instead of 2 to save space
Last edited by Prestige (2012-08-26 13:38:28)
Offline
Prestige wrote:
*scripts are too long and complicated for me to fix and they look incorrect in visual mode. You'll have to quote this and read the text to try and understand what's going on. Sorry about that..
____________
How about:delete [all v] of [list v] add (join ([abs v] of ([x position v] of [note 1 v])) (([abs v] of ([y position v] of [note 1 v])) * (-1))) to [list v] if <(letter (1) of (x position)) = (-)> replace item [last v] of [list v] with (join (item [last v] of [list v]) (-)) else replace item [last v] of [list v] with (join (item [last v] of [list v]) (0)) end if <(letter (1) of (y position)) = (-)> replace item [last v] of [list v] with (join (item [last v] of [list v]) (-)) else replace item [last v] of [list v] with (join (item [last v] of [list v]) (0)) endThen to get the values back:set [counter v] to (1) repeat (length of [list v]) set [letter v] to (1) repeat until <(letter (letter) of (item (counter) of [list v])) = (-)> set [x v] to (join (x) (letter (letter) of (item (counter) of [list v]))) change [letter v] by (1) end change [letter v] by (1) repeat until <(letter) > (length of (item (counter) of [list v]))> set [y v] to (join (y) (letter (letter) of (item (counter) of [list v]))) change [letter v] by (1) end end set [x v] to (join (letter (length of (item (counter) of [list v])) of (1)) (x)) set [y v] to (join (letter (length of (item (counter) of [list v])) of (0)) (x))Then set x and y to the x and y variables. This combines both x and y values in 1 item, instead of 2 to save space
Fixed!
Last edited by ErnieParke (2012-08-26 15:34:19)
Offline