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

#1 2010-01-09 17:36:47

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

how to make a scrolling game

help me make a scrolling game please!!!!!  sad


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#2 2010-01-09 18:07:14

Flait7
Scratcher
Registered: 2008-04-14
Posts: 100+

Re: how to make a scrolling game

If you want to make the background scroll either make sprites behind your character move in the opposite direction that s/he is moving, make the background switch backgrounds that create the same illusion or do both.  Or if you want to make a force scrolling game do the same thing just don't make it interact with the main character


http://scratch.mit.edu/static/projects/Flait7/2248016_sm.pnghttp://scratch.mit.edu/static/projects/Flait7/1827934_sm.png

Offline

 

#3 2010-01-09 18:48:30

Chatter
Scratcher
Registered: 2009-11-29
Posts: 500+

Re: how to make a scrolling game

First make 2 sprites. One for scrolling and one that's background size.

Then, make a variable called Scroll X. Make sure it's for all sprites. Make the following script:

<when green flag clicked>
<forever>
<set x to(  ((  <{  Scroll X  }>  <+>  480  ))
<end>

<when green flag clicked>
<forever>
<set x to(  ((  <{  Scroll X  }>  <+>  ((  480 <*>  0 ))  ))
<end>
Those ones are for the sprite for scrolling.

For the one that's background size, make these scripts:

<when green flag clicked>
<forever>
<set x to(  ((  <{  Scroll X  }>  <+>  980 ))
<end>

<when green flag clicked>
<forever>
<set x to(  ((  <{  Scroll X  }>  <+>  ((  480  <*>  1  )) ))
<end>

If you want to make the scrolling effect restart once it's reached the end, simply make an exact duplicate of the background size sprite and make it appear last. Finally, make this script:

<when green flag clicked>
<forever>
<if> <(  <x position>  <<>  0  )>
<set{  Scroll X  }to(  0
<end>
<end>

If you want your background sized sprite to scroll to the left, Scroll X needs to be changed by a negative number and when scrolling to the right, Scroll X needs to be changed by a positive number. Got it?  big_smile

I hope this helps!  big_smile 

Last edited by Chatter (2010-01-09 18:49:36)


http://img19.imageshack.us/img19/2339/mcdonaldsjoke.gifAll your problems are like batter when you add a little Chatter, because when you have Chat, you're safe from bats.  big_smile
"And so?" - The little people in my brain|Status: Snow in April?

Offline

 

#4 2010-01-09 19:00:59

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

Re: how to make a scrolling game

at this time today i start my scrolling game weeeeee


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#5 2010-01-09 19:03:41

Chatter
Scratcher
Registered: 2009-11-29
Posts: 500+

Re: how to make a scrolling game

articsky wrote:

at this time today i start my scrolling game weeeeee

Good luck on it!  big_smile  If there is a problem or you need help, feel free to ask me!  wink


http://img19.imageshack.us/img19/2339/mcdonaldsjoke.gifAll your problems are like batter when you add a little Chatter, because when you have Chat, you're safe from bats.  big_smile
"And so?" - The little people in my brain|Status: Snow in April?

Offline

 

#6 2010-01-09 19:28:23

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

Re: how to make a scrolling game

ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh  : it did not work!!!!


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#7 2010-01-09 19:32:19

Chatter
Scratcher
Registered: 2009-11-29
Posts: 500+

Re: how to make a scrolling game

articsky wrote:

ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh  : it did not work!!!!

That's too bad.  sad  Try redoing it, or asking more experienced Scratchers for help.  smile


http://img19.imageshack.us/img19/2339/mcdonaldsjoke.gifAll your problems are like batter when you add a little Chatter, because when you have Chat, you're safe from bats.  big_smile
"And so?" - The little people in my brain|Status: Snow in April?

Offline

 

#8 2010-01-09 21:34:47

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

Re: how to make a scrolling game

wait a minute me got idea do you have any scroling games if so i can study it and make my own. LOL.


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#9 2010-01-09 21:48:45

Chatter
Scratcher
Registered: 2009-11-29
Posts: 500+

Re: how to make a scrolling game

articsky wrote:

wait a minute me got idea do you have any scroling games if so i can study it and make my own. LOL.

Not really. I know scrolling but I never use it. But I also know this Scratcher, FMT who makes a ton of scrolling projects. Maybe it'll help you.  big_smile  Here's the link to his profile: http://scratch.mit.edu/users/floatingmagictree


http://img19.imageshack.us/img19/2339/mcdonaldsjoke.gifAll your problems are like batter when you add a little Chatter, because when you have Chat, you're safe from bats.  big_smile
"And so?" - The little people in my brain|Status: Snow in April?

Offline

 

#10 2010-01-09 21:51:48

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

Re: how to make a scrolling game

asome totally


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#11 2010-02-07 14:00:13

articsky
Scratcher
Registered: 2010-01-09
Posts: 9

Re: how to make a scrolling game

it's so sad i failed look at it in my profile its called false scrolling  game


[img]http:http://t0.gstatic.com/images?q=tbn:AVugKt5h8emP-M:http://www.destination360.com/europe/sweden/images/s/sweden-ice-hotel.jpg[img]

Offline

 

#12 2010-02-07 14:48:43

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: how to make a scrolling game

Here's a scrolling engine using one sprite for the character (no hit test sprites) and 2 sprites for terrain, you can use it but give credit to me and RHY3756547:
http://scratch.mit.edu/projects/juststickman/869679
(edit the costumes, both land sprites have to have costumes in the same order)


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#13 2010-02-07 23:12:17

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: how to make a scrolling game

Scrolling has one main variable, Scroll X. This variable records where you are on the area.

There are many ways to do scrolling. Here's the compact way, with two sprites for the terrain. The variables:

Scroll X: The usual variable that keeps track of where you are, nothing big.
Terrain number: The variable that tells the terrain sprites what costume to be in.

http://img171.imageshack.us/img171/6475/39twospritescrolling.png

You need to have several costumes for each terrain sprite; they're going to be the only terrain sprites, so you'll have to re-use them.

There's an easier way to do scrolling, but with many sprites for the terrain. No terrain sprites are re-used - which means that the variable Terrain Number isn't needed.

http://img697.imageshack.us/img697/3214/40manyspritescrolling.png

You'll have noticed one thing we're missing - the script that sets the Scroll X variable! Well, there are two ways: One with velocity, and one without. Here are the two scripts:

http://img194.imageshack.us/img194/2497/41scrollxmovingscripts.png

And that's it. Some tutorials for scrolling:
   archmage's Scrolling Done Right (many-sprite scrolling)
   archmage's Efficient Scrolling Demo (two-sprite scrolling) (not exactly a tutorial, but you can download the project and take a look)


Any questions?

Last edited by Jonathanpb (2010-02-07 23:39:27)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#14 2010-04-28 15:21:04

invinceableian
Scratcher
Registered: 2009-10-08
Posts: 20

Re: how to make a scrolling game

I don't understand!!! Is there a simpler way?!? PLEASE SAY THERE IS!


(Insert clever and amusing signature here)

Offline

 

#15 2010-06-11 19:13:12

sharmar
Scratcher
Registered: 2010-05-15
Posts: 3

Re: how to make a scrolling game

Its kinda tricky  smile

Offline

 

#16 2010-07-29 14:43:20

ppppp420
Scratcher
Registered: 2010-06-24
Posts: 29

Re: how to make a scrolling game

[blocks] <when green flag clicked> [/blocks]
[blocks]<forever>[/blocks]
[blcoks]<set x to( (( <{ scrollx }> <+>(( 480 <*> terrain number ))  ))


http://i822.photobucket.com/albums/zz150/ppppp420/Forver.png

Offline

 

#17 2010-07-29 15:41:07

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: how to make a scrolling game

Unfortunately, there isn't a simpler way.  hmm  Scrolling is a tough thing; take a look at my post on this topic.


http://i51.tinypic.com/20gcn5j.png

Offline

 

#18 2010-07-30 19:58:42

Thomas96
Scratcher
Registered: 2010-03-25
Posts: 100+

Re: how to make a scrolling game

invinceableian wrote:

I don't understand!!! Is there a simpler way?!? PLEASE SAY THERE IS!

As JeanTheFox said, scrolling games are not easy. Try taking a look at my scrolling demo: http://scratch.mit.edu/projects/Thomas96/1206903 :

Offline

 

#19 2010-07-30 20:02:20

Thomas96
Scratcher
Registered: 2010-03-25
Posts: 100+

Re: how to make a scrolling game

AS I said, it is only a demo, so it isn't perfect.

Offline

 

#20 2010-07-30 20:04:38

Thomas96
Scratcher
Registered: 2010-03-25
Posts: 100+

Re: how to make a scrolling game

If you only want a two way scroller (left and right) don't program the scroll y, if you want the sprite to jump in your game you still don't need the scroll y variable

Offline

 

#21 2010-08-03 10:58:20

mysticpoptart
Scratcher
Registered: 2010-07-17
Posts: 3

Re: how to make a scrolling game

make a varieable called scrollxhttp://scratch.mit.edu/forums/viewtopic.php?pid=477814#req_message<{  }>

Offline

 

Board footer