Discuss Scratch

Laslito777
Scratcher
8 posts

How can I have the coordinates of a clone?

Hi i need help to do my game called “Raise a floppa remake” and idk how to have the coordinates of the clone, can you help me please? I have a id system on my proyect

Last edited by Laslito777 (July 11, 2022 22:13:44)

cIoudyness
Scratcher
500+ posts

How can I have the coordinates of a clone?

you already have an id system. absolutely brilliant.

to get the coordinates of a clone, you need the clone to report its coordinates. no other way to get them.
so we can just tell the clone to, forever, pass its x and y position into lists with item (id). basically a clone with id of 1 constantly replaces item 1 of the x list with its x position and item 1 of the y list with its y position. and so on. then you can reference those when you need
abcde1234qwe
Scratcher
500+ posts

How can I have the coordinates of a clone?

when I start as a clone
if <(clone id) = [selected id goes here]> then
add [] to [X v]//For all sprites.
add [] to [Y v]//For all sprites
forever
replace item (1) of [X v] with (x position)
replace item (1) of [Y v] with (y position)
end
end
(technically @cloudyness's idea)

Last edited by abcde1234qwe (July 11, 2022 22:33:12)

cIoudyness
Scratcher
500+ posts

How can I have the coordinates of a clone?

im an idiot nevermind
carry on

Last edited by cIoudyness (July 11, 2022 22:45:48)

Laslito777
Scratcher
8 posts

How can I have the coordinates of a clone?

cIoudyness wrote:

you already have an id system. absolutely brilliant.

to get the coordinates of a clone, you need the clone to report its coordinates. no other way to get them.
so we can just tell the clone to, forever, pass its x and y position into lists with item (id). basically a clone with id of 1 constantly replaces item 1 of the x list with its x position and item 1 of the y list with its y position. and so on. then you can reference those when you need
Okay im gonna try this then

Last edited by Laslito777 (July 11, 2022 23:05:36)

Laslito777
Scratcher
8 posts

How can I have the coordinates of a clone?

cIoudyness wrote:

im an idiot nevermind
carry on
HEY THAT WORKED!! THANK YOU!
Laslito777
Scratcher
8 posts

How can I have the coordinates of a clone?

abcde1234qwe wrote:

when I start as a clone
if <(clone id) = [selected id goes here]> then
add [] to [X v]//For all sprites.
add [] to [Y v]//For all sprites
forever
replace item (1) of [X v] with (x position)
replace item (1) of [Y v] with (y position)
end
end
(technically @cloudyness's idea)
You really help me!
StickMan1087
Scratcher
18 posts

How can I have the coordinates of a clone?

when I start as a clone
set [ cloneX] to (x position)
set [ cloneY] to (y position)

Powered by DjangoBB