hello, i just started using this program and dont know how to use it fully yet. I am making a project for school and need help. The assignment is to make an adventure game. For my project i would like the backround to move with the sprite as an endless loop creating a endless path for when you move the sprite. So when you move the sprite ( the sprite wont actually move, the backround will which i made a sprite too) please can someone help... this would be for the backround sprite...
[scratchblocks]
when [rightarrow] clicked
move (-5) steps
end
[scratchblocks]
when [leftarrow] clicked
move (5) steps
end
Offline
A way to do this would be scrolling, which you can look up on the wiki to get more help then we could give you.
http://wiki.scratch.mit.edu/wiki/Scratc … j673849j14
You can look through all those pages to find what you need!
Offline
Here's what I think:
the easy way is to make a separate sprite for each page.
make this variable:
(scrollx)In the stage or a separate sprite, make this script:
forever if <[right arrow v] key pressed?> change [scrollx v] by (-5) end if <[left arrow v] key pressed?> change [scrollx v] by (5) end set [scrollx v] to ((scrollx) mod ((480) * (insert number of costumes here))) endthe bottom line should make it loop.
forever set x to ((scrollx) + ((480) * (0)))//increment the zero for each page if <(x position)=((scrollx) + ((480) * (0)))>//increment the zero here, too show//this "if" statement makes it hide if it's too far off the stage. else hide end endI hope this helps, and works, too!
Last edited by thebriculator (2012-07-18 11:26:53)
Offline
thebriculator wrote:
forever set x to ((scrollx) + ((480) * (0)))//increment the zero for each page if <(x position)=((scrollx) + ((480) * (0)))>//increment the zero here, too show//this "if" statement makes it hide if it's too far off the stage. else hide end end
Just to explain a bit if you're new to scratch, the reason we use 480 in the scripts is because the scratch stage is 480x360. So if you were scrolling on the Y axis you'd use 360 instead
Offline
jono3814 wrote:
how would you set the backround to start at the first back round everytime you click the green flag ? so that the sprite starts at the first backround everytime you want to play...
Just have it set scrollx to 0
when gf clicked set [scrollx v] to [0]
Last edited by wolfdude999 (2012-07-18 13:00:25)
Offline