This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-31 13:23:07

tree-hugger
Scratcher
Registered: 2011-11-19
Posts: 38

need help with X and Y scrolling

So I'm making a project with a bunch of levels. I understand scroll X and I have a scrolling engine I like, I just don't know how to do scroll y or how to do scroll X and Y at the same time. Please try to explain this in the most basic way you can I'm pretty new to programming so I don't know much about that sort of computery stuff  tongue . If Anyone can give me a script for a X and Y scrolling leveled script that I can mess with, or find a project that uses X and Y scrolling, that would be a big help! I can't wait for your feedback  smile  !


http://oi48.tinypic.com/1y7tjr.jpghttp://oi50.tinypic.com/28tb34j.jpg                     http://oi50.tinypic.com/21c6v74.jpg                    ...ya, I'm weird... REAL weird...
BITBOT ALL THE WAY!!!     Only the WEIRDEST games!     (that's just  a Tree-Hugger thing)

Offline

 

#2 2012-08-31 14:07:34

pizza22
Scratcher
Registered: 2012-04-30
Posts: 500+

Re: need help with X and Y scrolling

tree-hugger wrote:

So I'm making a project with a bunch of levels. I understand scroll X and I have a scrolling engine I like, I just don't know how to do scroll y or how to do scroll X and Y at the same time. Please try to explain this in the most basic way you can I'm pretty new to programming so I don't know much about that sort of computery stuff  tongue . If Anyone can give me a script for a X and Y scrolling leveled script that I can mess with, or find a project that uses X and Y scrolling, that would be a big help! I can't wait for your feedback  smile  !

when gf clicked
forever
     if <key [up arrow v] pressed>
          change (scroll y) by [-2]
          end
     if <key [down arrow v] pressed>
          change (scroll y) by [2]
          end
     if <key [left arrow v] pressed>
          change (scroll x) by [2]
          end
     if <key [right arrow v] pressed>
          change (scroll x) by [-2]
          end

for terain
when gf clicked
forever
     go to x:<(x scroll) + [480]> y:<(y scroll) + [something]>

Last edited by pizza22 (2012-08-31 14:25:23)

Offline

 

#3 2012-08-31 14:17:04

Zarule6
New Scratcher
Registered: 2012-08-02
Posts: 36

Re: need help with X and Y scrolling


when I receive [JOKERVILLE v]
set (scrolly v) to [0]
set (scrollx v) to [0]
show
forever
 go to  x: <(scrollx) +<[480]*[0]>>  y:<(scrolly) +<[360]*[1]>>    // change * by1 every time you want it to go further North 


when (w v) key pressed
change (scrolly v) by (7)

when (w v) key pressed
change (scrolly v) by (-7)

Hope this helps  smile  ,if you need an physical example simply ask and I'll upload an example quickly

Offline

 

#4 2012-08-31 14:23:09

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: need help with X and Y scrolling

^^^
neither of you are correct

when gf clicked
set [x v] to [0]
set [y v] to [0]
forever
if <key [up arrow v] pressed?>
change [y v] by (-5)
end
if <key [down arrow v] pressed?>
change [y v] by (5)
end
if <key [left arrow v] pressed?>
change [x v] by (5)
end
if <key [right arrow v] pressed?>
change [x v] by (-5)
end
when gf clicked
forever
go to x:((x) + ((xpos) * (480))) y:((y) + ((ypos) * (360)))
xpos and ypos refer to a grid. so if xpos = 0 and ypos = 0 are the center of the map, the map to the right would be xpos = 1, ypos = 0, and the map above would be xpos=0, ypos=1

Last edited by Wes64 (2012-08-31 14:23:48)


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#5 2012-08-31 14:24:37

pizza22
Scratcher
Registered: 2012-04-30
Posts: 500+

Re: need help with X and Y scrolling

pizza22 wrote:

tree-hugger wrote:

So I'm making a project with a bunch of levels. I understand scroll X and I have a scrolling engine I like, I just don't know how to do scroll y or how to do scroll X and Y at the same time. Please try to explain this in the most basic way you can I'm pretty new to programming so I don't know much about that sort of computery stuff  tongue . If Anyone can give me a script for a X and Y scrolling leveled script that I can mess with, or find a project that uses X and Y scrolling, that would be a big help! I can't wait for your feedback  smile  !

when gf clicked
forever
     if <key [up arrow v] pressed>
          change y by [-2]
          end
     if <key [down arrow v] pressed>
          change y by [2]
          end
     if <key [left arrow v] pressed>
          change x by [2]
          end
     if <key [right arrow v] pressed>
          change x by [-2]
          end

for terain
when gf clicked
forever
     go to x:<(x scroll) + [480]> y:<(y scroll) + [something]>

oh..sorry ( I meant to change varible instead of position  smile

Offline

 

#6 2012-08-31 14:25:43

pizza22
Scratcher
Registered: 2012-04-30
Posts: 500+

Re: need help with X and Y scrolling

It is right now

Offline

 

#7 2012-08-31 14:46:35

Zarule6
New Scratcher
Registered: 2012-08-02
Posts: 36

Re: need help with X and Y scrolling

Wes64 wrote:

^^^
neither of you are correct

^_^ actually I'm implementing the code I posted into my RPG and it's working perfectly at every level so far  tongue

Offline

 

#8 2012-08-31 14:49:14

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: need help with X and Y scrolling

Zarule6 wrote:

Wes64 wrote:

^^^
neither of you are correct

^_^ actually I'm implementing the code I posted into my RPG and it's working perfectly at every level so far  tongue

yours wasnt incorrect, just incomplete. there were no x-scroll options


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#9 2012-08-31 14:59:34

Zarule6
New Scratcher
Registered: 2012-08-02
Posts: 36

Re: need help with X and Y scrolling

ohhh xD,Tnx for pointing that out,was about to run through my whole game again just to make sure Dx

Offline

 

Board footer