Hey guys. I'm working on a space game, and i need to be able to scroll both left/right and up/down. I've got the left right figured out, (it's very simple) but once i try to add the same scripts for y, (substituting 480 for 360 of course) the "terrain" sprites end up being diagonal to each other, like so:
Does anyone know what im doing wrong?
.................
.................
.................
.............
.............
.............
.............
.............
.............
P.S My code for each sprite is
[blocks]
<when green flag clicked>
<forever>
<set x to( (( <{ ScrollX }> <+> (( 480 <*> 0 )) )) (i add 1 for each terrain, blahblahblah)
<set y to( (( <{ ScrollY }> <+> (( 360 <*> 0 )) ))
And yah......
Offline
I know what you are doing, your scripts look like this I bet
//for terrain 1
greenflag
forever
set x to (( { ScrollX } + (( 480 * 0 )) )) (i add 1 for each terrain, blahblahblah)
set y to (( { ScrollY } + (( 360 * 0 )) ))
//for terrain 2
greenflag
forever
set x to (( { ScrollX } + (( 480 * 1 )) )) (i add 1 for each terrain, blahblahblah)
set y to (( { ScrollY } + (( 360 * 1 )) ))
This is not how to make a proper grid which is what you want.
For this grid, the number for the scrollX is on the left and the number for scrollY is on the right for each set of values
(0,2) (1,2) (2,2) (3,2)
(0,1) (1,1) (2,1) (3,1)
(0,0) (1,0) (2,0) (3,0)
_
Looking at this grid, since your sprites were like _ -
Your numbers were like this:
for the first sprite, 0 for scrollX and 0 for scrollY
for the second sprite, 1 for scrollX and 1 for scrollY
for the third sprite 2 for scrollX and 2 for scrollY
Now see how those numbers line up with the grid I typed
the number beside scrollX controls the far to the side the sprite is and the number beside scrollY controls how far up the sprite is.
Here is an example of this http://scratch.mit.edu/projects/archmage/100982
Last edited by archmage (2010-05-06 23:39:28)
Offline
OOHHHH i see what you mean... But how would i fix it? I've been trying.. Do i do it like
scrollX=480*2
scrollY=360*1
is that it??
i think im wrong tho
Last edited by frozenveinz (2010-05-06 23:50:19)
Offline
Try looking at the code in the example project.
Offline
I do 480*(a number of where it is eg the first is 0 the second it 1)-{SCROLLX})
Offline
I'm just so happen to be making a verticalscroller, and it appears you have the right idea..
What I did was
Forever(acutally the block is "repeat until")
goto x: (scrollx + 480 * 0) y: (scrolly + 360 * 0) (ground level, first platform)
next block would be 480 * 1 and 360 *1(if you were making a tiled thing like you mentioned.)
Offline
PupStar wrote:
HELP ME WITH SCROLLING... The terrain randomly moves!!! I know you do scrollx and change x by scrollx x terrain or something
It's actually set x to scrollx*terrain, which should sort out your issues for the most part.
Hope that helps!
Offline
I need help D= i trying to make a game that scrolls x and y with more than one sprites. plz respond.
Offline
based on pokemon gaming i have created a 4 directional scrolling screen but i have a bed sprite made of three sprites (definetly dont meen costumes) and when i walk upwards they either move seperate or make the whole thing look terrible how do i get them to move of screen thank you
please explain simply i was good at maths until they threw letters in so x and y axi can be a bit frustrating
thanks again
Offline
http://<move( )steps><move( )steps><move( )steps>scratch.mit.edu/forums/viewtopic.php?id=35277#req_message
Offline
This sounds like it should be in All About Scratch.
Offline
this should be in all about scratch
Offline
try this <when green flag clicked><set x to( (( <+> 480 <*>0 ))
then for the next one do <when green flag clicked><set x to( (( <+> 480 <*>1 ))
and so on hop it works for u
Offline
adam_spillers wrote:
try this <when green flag clicked><set x to( (( <+> 480 <*>0 ))
then for the next one do <when green flag clicked><set x to( (( <+> 480 <*>1 ))
and so onhop it works for u
You need to put a forever block around it, else it will only go to that position when the project is started, and won't move from then on.
Offline