Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Tutorial - How to Make a Scrolling Game
- MCAnimator3D
-
500+ posts
Tutorial - How to Make a Scrolling Game
Hello, all! Lots of people (especially New Scratchers) need help with a scrolling game. This will teach people how to make a simple scrolling game with velocity.
First go to the data tab, create a variable and call it “ScrollX”.
That concludes this tutorial. You can add whatever you want to the game and make it your own! Happy Scratching!
First go to the data tab, create a variable and call it “ScrollX”.
(ScrollX)Now put this into the scripts section on the character sprite:
when green flag clickedWhen you do scrolling, you want to make it so when you press an arrow key the terrain goes backwards and looks like the character is moving. This is what you put under the set ScrollX to 0:
set [ScrollX v] to [0]
foreverRight now, it won't do anything because we have to assign the variable to the terrain. First, create a level sprite with one color on top and another color below it. Put this script in it:
if <key [left arrow v] pressed?> then
change [ScrollX v] by (3)
end
if <key [right arrow v] pressed?> then
change [ScrollX v] by (-3)
end
when green flag clickedNow click the green flag. It works! When you press the arrow keys, the character (technically the ground) it moving! We need the character to jump now. We will be using Velocity. Create a variable called YVel.
set y to (0)
forever
set x to ((ScrollX) + ((480) * (0)))
end
(YVel)Put this script into the character:
when green flag clickedIf you press the up arrow, you now jump!
go to front
go to x: (0) y: (0)
set [YVel v] to [0]
forever
change y by (YVel)
if <touching color [#000]?> then
set [YVel v] to [0]
end
if <not <touching color [#000]?>> then
change [YVel v] by (-1)
end
if <<touching color [#000]?> and <key [up arrow v] pressed?>> then
change [YVel v] by (10)
end
end
That concludes this tutorial. You can add whatever you want to the game and make it your own! Happy Scratching!
- Photoguy77
-
100+ posts
Tutorial - How to Make a Scrolling Game
This is a great idea! Maybe try making one for Scroll Y?
- lafoudre
-
100+ posts
Tutorial - How to Make a Scrolling Game
I like your tutorial.
It is very simple and concise. Thanks to scratchblocks.
I used to go to the wiki: http://wiki.scratch.mit.edu/wiki/Scrolling_game
It is very simple and concise. Thanks to scratchblocks.
I used to go to the wiki: http://wiki.scratch.mit.edu/wiki/Scrolling_game
- kmeemaster
-
60 posts
Tutorial - How to Make a Scrolling Game
One issuse is he can't climb hilly terrain
- MCAnimator3D
-
500+ posts
Tutorial - How to Make a Scrolling Game
Oh yeah! I forgot to put that in! One issuse is he can't climb hilly terrain
- RedNeckSideKick
-
67 posts
Tutorial - How to Make a Scrolling Game
I can't figure out how to make it not disappear on the edges…
Last edited by RedNeckSideKick (Nov. 17, 2013 23:32:36)
- Sonickyle
-
1000+ posts
Tutorial - How to Make a Scrolling Game
Perhaps make a section on how to create a bounding box for the character for advanced Detection?
Also, there is also a wiki tutorial.
Also, there is also a wiki tutorial.
- Sonickyle
-
1000+ posts
Tutorial - How to Make a Scrolling Game
Please don't necrobump age-old threads.
- Davidstudio
-
100+ posts
Tutorial - How to Make a Scrolling Game
What do you mean “One color on top and one on the bottom?”
- garfieldgarf
-
4 posts
Tutorial - How to Make a Scrolling Game
Hello, all! Lots of people (especially New Scratchers) need help with a scrolling game. This will teach people how to make a simple scrolling game with velocity.
First go to the data tab, create a variable and call it “ScrollX”.
ScrollX
Now put this into the scripts section on the character sprite:
when clickedset ScrollX to 0
When you do scrolling, you want to make it so when you press an arrow key the terrain goes backwards and looks like the character is moving. This is what you put under the set ScrollX to 0:
foreverif key left arrow pressed? thenchange ScrollX by 3if key right arrow pressed? thenchange ScrollX by -3
Right now, it won't do anything because we have to assign the variable to the terrain. First, create a level sprite with one color on top and another color below it. Put this script in it:
when clickedset y to 0foreverset x to ScrollX + 480 * 0
Now click the green flag. It works! When you press the arrow keys, the character (technically the ground) it moving! We need the character to jump now. We will be using Velocity. Create a variable called YVel.
YVel
Put this script into the character:
when clickedgo to frontgo to x: 0 y: 0set YVel to 0foreverchange y by YVelif touching color ? thenset YVel to 0if not touching color ? thenchange YVel by -1if touching color ? and key up arrow pressed? thenchange YVel by 10
If you press the up arrow, you now jump!
That concludes this tutorial. You can add whatever you want to the game and make it your own! Happy Scratching!
Report | Quote
#2Nov. 17, 2013 10:30:05
Photoguy77
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
This is a great idea! Maybe try making one for Scroll Y?
-Photoguy77
“Without enjoying, one will never truly learn” ~Flome
“Finding happiness starts in you” ~ProdigyZeta7
Report | Quote
#3Nov. 17, 2013 13:34:46
lafoudre
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
I like your tutorial.
It is very simple and concise. Thanks to scratchblocks.
I used to go to the wiki: http://wiki.scratch.mit.edu/wiki/Scrolling_game
Report | Quote
#4Nov. 17, 2013 14:16:05
kmeemaster
Scratcher
60 posts
Tutorial - How to Make a Scrolling Game
One issuse is he can't climb hilly terrain
Report | Quote
#5Nov. 17, 2013 14:58:59
MCAnimator3D
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
kmeemaster wrote:
One issuse is he can't climb hilly terrain
Oh yeah! I forgot to put that in!
Report | Quote
#6Nov. 17, 2013 17:19:42
RedNeckSideKick
Scratcher
67 posts
Tutorial - How to Make a Scrolling Game
I can't figure out how to make it not disappear on the edges…
Last edited by RedNeckSideKick (Nov. 17, 2013 17:32:36)
Report | Quote
#7Nov. 18, 2013 07:24:23
Sonickyle
Scratcher
1000+ posts
Tutorial - How to Make a Scrolling Game
Perhaps make a section on how to create a bounding box for the character for advanced Detection?
Also, there is also a wiki tutorial.
FNAF is still allowed on Scratch.
Direct emulations and games with the jumpscares are not allowed!
I don't really make Scratch projects anymore. I've moved onto Unity and Java.
Now, if only I could figure out how to program in C#…
Also, I play Phantasy Star Online 2 on the Japanese servers! I'm Rock Dasher on Ship 2; I'm a Bouncer/Techer.
Report | Quote
#8Oct. 24, 2014 17:37:03
ProgrammingSheep123
New to Scratch
1 post
Tutorial - How to Make a Scrolling Game
Report | Quote
#9Oct. 26, 2014 05:32:15
Sonickyle
Scratcher
1000+ posts
Tutorial - How to Make a Scrolling Game
ProgrammingSheep123 wrote:
Please don't necrobump age-old threads.
FNAF is still allowed on Scratch.
Direct emulations and games with the jumpscares are not allowed!
I don't really make Scratch projects anymore. I've moved onto Unity and Java.
Now, if only I could figure out how to program in C#…
Also, I play Phantasy Star Online 2 on the Japanese servers! I'm Rock Dasher on Ship 2; I'm a Bouncer/Techer.
Report | Quote
#10Nov. 12, 2014 15:38:37
riceandbeans24
Scratcher
2 posts
Tutorial - How to Make a Scrolling Game
It worked!
Report | Quote
#11Nov. 12, 2014 16:17:41
riceandbeans24
Scratcher
2 posts
Tutorial - How to Make a Scrolling Game
Report | Quote
#12Nov. 12, 2014 23:50:03
Locomule
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
Like this?
___________________________________________________________________________
Need help? Try the Scratch Wiki!
Report | Quote
#13Nov. 26, 2014 12:46:10
Davidstudio
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
What do you mean “One color on top and one on the bottom?”
My last siggy was reported, I tried getting it back, but it was eaten by an evil kumquat.
Report | Quote
#14Feb. 9, 2015 16:57:04
GodzillaKing100
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
THANKS!!!!
| Ball |
Game Editor | Space Survival | ElectroLight PC | Simple Simon | Space Wars | Coded Secret | Project | Planet | Cannon Wars | Five Nights At FredBear's | Vortex | Lost Worlds | Vortex 2 |
Report | Quote
Discussion Forums » Help With Scripts » Tutorial - How to Make a Scrolling Game
Follow Discussion
New Reply
Message
Bold
Italic
Underline
Stroke
—————
Picture
Link
—————
Size
—————
Bulleted list
Numeric list
List item
—————
Quotes
Smiles
—————
Paste browser / operating system versions
—————
Scratchblocks
—————
Clean
Preview
Submit Go back
Powered by DjangoBB
Standard | Mobile
About
About Scratch For Parents For Educators Credits Jobs Press
Community
Community Guidelines Discussion Forums Scratch Wiki Statistics
Support
Help Page FAQ Offline Editor Contact Us Donate
Legal
Terms of Use Privacy Policy DMCA
Scratch Family
ScratchEd ScratchJr Scratch Day Scratch Conference Scratch Foundation
First go to the data tab, create a variable and call it “ScrollX”.
ScrollX
Now put this into the scripts section on the character sprite:
when clickedset ScrollX to 0
When you do scrolling, you want to make it so when you press an arrow key the terrain goes backwards and looks like the character is moving. This is what you put under the set ScrollX to 0:
foreverif key left arrow pressed? thenchange ScrollX by 3if key right arrow pressed? thenchange ScrollX by -3
Right now, it won't do anything because we have to assign the variable to the terrain. First, create a level sprite with one color on top and another color below it. Put this script in it:
when clickedset y to 0foreverset x to ScrollX + 480 * 0
Now click the green flag. It works! When you press the arrow keys, the character (technically the ground) it moving! We need the character to jump now. We will be using Velocity. Create a variable called YVel.
YVel
Put this script into the character:
when clickedgo to frontgo to x: 0 y: 0set YVel to 0foreverchange y by YVelif touching color ? thenset YVel to 0if not touching color ? thenchange YVel by -1if touching color ? and key up arrow pressed? thenchange YVel by 10
If you press the up arrow, you now jump!
That concludes this tutorial. You can add whatever you want to the game and make it your own! Happy Scratching!
Report | Quote
#2Nov. 17, 2013 10:30:05
Photoguy77
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
This is a great idea! Maybe try making one for Scroll Y?
-Photoguy77
“Without enjoying, one will never truly learn” ~Flome
“Finding happiness starts in you” ~ProdigyZeta7
Report | Quote
#3Nov. 17, 2013 13:34:46
lafoudre
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
I like your tutorial.
It is very simple and concise. Thanks to scratchblocks.
I used to go to the wiki: http://wiki.scratch.mit.edu/wiki/Scrolling_game
Report | Quote
#4Nov. 17, 2013 14:16:05
kmeemaster
Scratcher
60 posts
Tutorial - How to Make a Scrolling Game
One issuse is he can't climb hilly terrain
Report | Quote
#5Nov. 17, 2013 14:58:59
MCAnimator3D
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
kmeemaster wrote:
One issuse is he can't climb hilly terrain
Oh yeah! I forgot to put that in!
Report | Quote
#6Nov. 17, 2013 17:19:42
RedNeckSideKick
Scratcher
67 posts
Tutorial - How to Make a Scrolling Game
I can't figure out how to make it not disappear on the edges…
Last edited by RedNeckSideKick (Nov. 17, 2013 17:32:36)
Report | Quote
#7Nov. 18, 2013 07:24:23
Sonickyle
Scratcher
1000+ posts
Tutorial - How to Make a Scrolling Game
Perhaps make a section on how to create a bounding box for the character for advanced Detection?
Also, there is also a wiki tutorial.
FNAF is still allowed on Scratch.
Direct emulations and games with the jumpscares are not allowed!
I don't really make Scratch projects anymore. I've moved onto Unity and Java.
Now, if only I could figure out how to program in C#…
Also, I play Phantasy Star Online 2 on the Japanese servers! I'm Rock Dasher on Ship 2; I'm a Bouncer/Techer.
Report | Quote
#8Oct. 24, 2014 17:37:03
ProgrammingSheep123
New to Scratch
1 post
Tutorial - How to Make a Scrolling Game
Report | Quote
#9Oct. 26, 2014 05:32:15
Sonickyle
Scratcher
1000+ posts
Tutorial - How to Make a Scrolling Game
ProgrammingSheep123 wrote:
Please don't necrobump age-old threads.
FNAF is still allowed on Scratch.
Direct emulations and games with the jumpscares are not allowed!
I don't really make Scratch projects anymore. I've moved onto Unity and Java.
Now, if only I could figure out how to program in C#…
Also, I play Phantasy Star Online 2 on the Japanese servers! I'm Rock Dasher on Ship 2; I'm a Bouncer/Techer.
Report | Quote
#10Nov. 12, 2014 15:38:37
riceandbeans24
Scratcher
2 posts
Tutorial - How to Make a Scrolling Game
It worked!
Report | Quote
#11Nov. 12, 2014 16:17:41
riceandbeans24
Scratcher
2 posts
Tutorial - How to Make a Scrolling Game
Report | Quote
#12Nov. 12, 2014 23:50:03
Locomule
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
Like this?
___________________________________________________________________________
Need help? Try the Scratch Wiki!
Report | Quote
#13Nov. 26, 2014 12:46:10
Davidstudio
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
What do you mean “One color on top and one on the bottom?”
My last siggy was reported, I tried getting it back, but it was eaten by an evil kumquat.
Report | Quote
#14Feb. 9, 2015 16:57:04
GodzillaKing100
Scratcher
100+ posts
Tutorial - How to Make a Scrolling Game
THANKS!!!!
| Ball |
Game Editor | Space Survival | ElectroLight PC | Simple Simon | Space Wars | Coded Secret | Project | Planet | Cannon Wars | Five Nights At FredBear's | Vortex | Lost Worlds | Vortex 2 |
Report | Quote
Discussion Forums » Help With Scripts » Tutorial - How to Make a Scrolling Game
Follow Discussion
New Reply
Message
Bold
Italic
Underline
Stroke
—————
Picture
Link
—————
Size
—————
Bulleted list
Numeric list
List item
—————
Quotes
Smiles
—————
Paste browser / operating system versions
—————
Scratchblocks
—————
Clean
Preview
Submit Go back
Powered by DjangoBB
Standard | Mobile
About
About Scratch For Parents For Educators Credits Jobs Press
Community
Community Guidelines Discussion Forums Scratch Wiki Statistics
Support
Help Page FAQ Offline Editor Contact Us Donate
Legal
Terms of Use Privacy Policy DMCA
Scratch Family
ScratchEd ScratchJr Scratch Day Scratch Conference Scratch Foundation
- Sonickyle
-
1000+ posts
Tutorial - How to Make a Scrolling Game
Please don't spam useless posts. …
- WOTNAMENOAKEN
-
1 post
Tutorial - How to Make a Scrolling Game
is that soPlease don't necrobump age-old threads.
- Discussion Forums
- » Help with Scripts
-
» Tutorial - How to Make a Scrolling Game