I realised, when making one of my projects, that it's nearly impossible to make a script that would allow you to find the highest/lowest value in a list. I'd like it if the Scratch Team could make that in the next version of Scratch. I was trying to make my tower defense game have target priorities by using lists for distances,etc. but I couldn't figure out how to do that without making Scratch go extremely slow. I'd like it if Scratch 2.0 had that block.
Offline
Well, this workaround:
set [counter v] to [1] set [done? v] to [0] repeat until <(done?) = [1]> set [done v] to [1] repeat ((length of [list v]) - (1)) if <(item (counter) of [list v]) < (item ((counter) + (1)) of [list v])> set [temp v] to (item (counter) of [list v]) replace item (counter) of [list v] with (item ((counter) + (1)) of [list v]) replace item ((counter) + (1)) of [list v] with (temp) set [done v] to [0] end change [counter v] by (1) end endIt works quite well, and is nearly instant in the Flash player.
Offline
BirdByte wrote:
Well, this workaround:
set [counter v] to [1] set [done? v] to [0] repeat until <(done?) = [1]> set [done v] to [1] repeat ((length of [list v]) - (1)) if <(item (counter) of [list v]) > (item ((counter) + (1)) of [list v])> set [temp v] to (item (counter) of [list v]) replace item (counter) of [list v] with (item ((counter) + (1)) of [list v]) replace item ((counter) + (1)) of [list v] with (temp) set [done v] to [0] end change [counter v] by (1) end endIt works quite well, and is nearly instant in the Flash player.
But will still be laggy if you have a ton of scripts.
Offline
^^^
no it won't, thats kinda a myth. The players run just as quick with 200 scripts as it does with one.
Offline
jontmy00 wrote:
You're asking the floor and ceiling block? It was suggested before if I remembered correctly.
I support.
Floor/ceiling blocks would be completely different to what's being suggested, though I would like those too.
I support.
Offline