Go back through itself? What do you mean?
Offline
CheeseMunchy wrote:
Go back through itself? What do you mean?
I'm trying to make a game, and there's a list called colors and, i need it to go through itself again. I'll upload it.
Last edited by coolhogs (2012-02-23 21:06:21)
Offline
What do you mean? Make the order reverse?
Offline
Use:
when I receive [gothrough v] set [i v] to [1] repeat (length of [colors v]) do stuff change [i v] by [1] endOr:
when I receive [gobackthrough v] set [i v] to (length of [colors v]) repeat (i) do stuff change [i v] by [-1] endIf you want to reverse the order of the items in a list, use this:
when I receive [reverse v] set [i v] to (length of [colors v]) repeat (i) add (item (i) of [colors v] ) to [templist v] change [i v] by [-1] end set [i v] to [1] repeat (length of [templist v]) replace item (i) of [colors v] with (item (i) of [templist v]) change [i v] by [1] end delete (all v) of [templist v]It should work...
Last edited by ProgramCAT (2012-02-24 15:41:02)
Offline
What do you mean by "go through itself"?
Offline
trinary wrote:
What exactly do you want the script to do?
I want the script to clone (more like stamping) the sprite and I want it to be a 1s1s project
Last edited by coolhogs (2012-02-24 16:46:43)
Offline
Like this?
When I Receive [render] set [i] to (1) go to x:(180) y:(-240) repeat(24) repeat(18) switch to costume (item (i) of [list]) stamp change x by (20) change [i] by (1) end set x to (-240) change y by (-20) end
Offline
MoreGamesNow wrote:
Like this?
When I Receive [render] set [i] to (1) go to x:(180) y:(-240) repeat(24) repeat(18) switch to costume (item (i) of [list]) stamp change x by (20) change [i] by (1) end set x to (-240) change y by (-20) end
no, i'm trying to do it without stamping.
Offline
Cloning is currently impossible in Scratch (at least, without "hacking"). I'm still not sure what "going through itself" means.
Offline
MoreGamesNow wrote:
Cloning is currently impossible in Scratch (at least, without "hacking"). I'm still not sure what "going through itself" means.
i mean like if you have a list and you want it to go through and pick out different colors and draw the results... like if you have green, and you want the sprite to draw the color.
Offline
Like this?
When I Receive [draw] set [i] to (0) repeat(length of [list]) change [i] by (1) if<(item (i) of [list]) = [red]> set pen color to [red] else if<(item (i) of [list]) = [blue]> set pen color to [blue] else if<(item (i) of [list]) = [green]> set pen color to [green] end end end draw stuff endYou can't select color based off of variables directly in Scratch (I believe you can in Panther though). A more efficient approach than the if-else statements may be to use the block:
set pen color to (item (i) of [list])
Last edited by MoreGamesNow (2012-02-24 21:29:00)
Offline
MoreGamesNow wrote:
Like this?
When I Receive [draw] set [i] to (0) repeat(length of [list]) change [i] by (1) if<(item (i) of [list]) = [red]> set pen color to [red] else if<(item (i) of [list]) = [blue]> set pen color to [blue] else if<(item (i) of [list]) = [green]> set pen color to [green] end end end draw stuff endYou can't select color based off of variables directly in Scratch (I believe you can in Panther though). A more efficient approach than the if-else statements may be to use the block:set pen color to (item (i) of [list])
Thanks I've tested it, and it worked great. But there's a problem. I was trying to upload it, but it went on forever. (I had to force quit it.) Could you possibly make it so that it doesn't have repeat blocks, if it's possible.
Last edited by coolhogs (2012-02-24 22:13:04)
Offline
MoreGamesNow wrote:
Like this?
When I Receive [draw] set [i] to (0) repeat(length of [list]) change [i] by (1) if<(item (i) of [list]) = [red]> set pen color to [red] else if<(item (i) of [list]) = [blue]> set pen color to [blue] else if<(item (i) of [list]) = [green]> set pen color to [green] end end end draw stuff endYou can't select color based off of variables directly in Scratch (I believe you can in Panther though). A more efficient approach than the if-else statements may be to use the block:set pen color to (item (i) of [list])
For this one, you can't put a () block in a color.
Offline
coolhogs wrote:
For this one, you can't put a () block in a color.
There are two "set pen color to" blocks. One accepts "round" blocks and the other is the color square. For the color square one (first one mentioned above), you need to use if-else statements and manually set the color. For the second one, you can change the color by setting it to a variable's number.
Also, when I said "set color to [green]", that was using the color-square-block. I don't know how to put in actual colors with the scratch blocks
Offline
MoreGamesNow wrote:
coolhogs wrote:
For this one, you can't put a () block in a color.
There are two "set pen color to" blocks. One accepts "round" blocks and the other is the color square. For the color square one (first one mentioned above), you need to use if-else statements and manually set the color. For the second one, you can change the color by setting it to a variable's number.
Also, when I said "set color to [green]", that was using the color-square-block. I don't know how to put in actual colors with the scratch blocks
oh ok!
(Should i give credit to you?)
Last edited by coolhogs (2012-02-24 23:12:23)
Offline
I don't think that's necessary in this case. I didn't really give you a concrete script, and, if you use the second method, all I did was point you to a block.
Offline
I tried using MoreGamesNow's script with his/her's block
Here is the result http://scratch.mit.edu/projects/coolhogs/2355713 It won't work. Can anyone fix it for me?
Offline
Here you go.
Offline