Discuss Scratch

tallent-kids
Scratcher
11 posts

scrolling help (fixed)

I tried to make a scrolling engine for a project I am making that worked in scratch 2.0,
but now it won't work. here are the scripts:
when green flag clicked
hide
set [ScrollX v] to [0]
delete (all v)of [ClonesPresent v]
repeat(5)
add(0) to [ClonesPresent v]
end
forever
generate
end



define generate
set [CloneNumber v] to (0)
set [BasePosition] to ((round ([abs v] of ((ScrollX)/(480))))+(1)
set [i v] to (-1)
repeat (3)
if <(item ((BasePosition) + (i)) of [ClonesPresent v] :: list)=[0]> then
switch costume to ((BasePosition)+(i))
replace item ((BasePosion)+(i)) of [ClonesPresent v] with [1]
create clone of [Myself v]
change [CloneNumber v] by (1)
end
change [i v] by (1)
end

when I start as a clone
set y to (0)
show
repeat until <([abs v] of (((480) * (costume #)) + (ScrollX))) > [719]>
set x to (((480) * (costume #)) + (ScrollX))
end
replace item (costume #) of [ClonesPresent v] with [0]
delete this clone
do you know why this is not working?


Last edited by tallent-kids (Jan. 22, 2019 18:54:22)

deck26
Scratcher
1000+ posts

scrolling help (fixed)

Much better to share the project than a script out of context. That also allows us to try tweaking the project to see what's happening.
tallent-kids
Scratcher
11 posts

scrolling help (fixed)

deck26
Scratcher
1000+ posts

scrolling help (fixed)

Curious that the list name is shown as ‘hide example’ on screen. I'd be tempted to create a new list, change all the blocks to refer to that and delete the old one. That may be a red herring but is odd.

Scrollx is decreased as you move left but that means the scrolling platforms move left - I'd have expected them to move right. Press and hold left arrow at the start until the scrolling platform moves - is that what you expect to happen?

Are you sure this worked in Scratch 2 or have you tweaked it since then?
tallent-kids
Scratcher
11 posts

scrolling help (fixed)

Your suggestion to change the list names and the arrow directions fixed my problem.
Thank you very much.
deck26
Scratcher
1000+ posts

scrolling help (fixed)

tallent-kids wrote:

Your suggestion to change the list names and the arrow directions fixed my problem.
Thank you very much.
Happy to help. The list name was a curious one though.

Powered by DjangoBB