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

#1 2012-08-14 09:51:50

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

infinite scrolling platform game

HI noob scratcher here. I'm making a platform game and I don't know how to have the game scroll the stage and then randomly pick a different costume for my stage. I already have 5 different costumes and i just want to figure out how to have the game randomly pick a different costume and then keep on going. If possible could you also show me how to jump realistically  when i press space ( the only control I'm going to have). Please be patient with me and try to explain how it works. Thanks.

Offline

 

#2 2012-08-14 10:14:56

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: infinite scrolling platform game

I could have it go on for a certain amount of time, but infinitely I'm not sure of. Would you like me to tell you the way I can do it?

Offline

 

#3 2012-08-14 10:18:21

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Yes please show me I'll just have it go on for a super long time it doesn't really matter.

Offline

 

#4 2012-08-14 10:34:51

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: infinite scrolling platform game

You can learn all about scrolling, and how it works, and learn how to do it on this Scratch wiki page.

To make the stage choose a random background, use this script:

switch to background (pick random (1) to [insert however many costumes the stage has])
As for y velocity, I can help you, but I feel too lazy to explain it all to you. Maybe in a few hours.  tongue


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#5 2012-08-14 10:40:33

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Thank you the random thing worked I'll look at the wiki page.

Offline

 

#6 2012-08-14 10:41:22

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: infinite scrolling platform game

Well, with the random picking, do what henley did, but whenever the scrolling background appears on the stage, it's costume should be saved.

Offline

 

#7 2012-08-14 10:46:20

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Sorry what I mean is i want the stage to scroll across the screen and have a random costume appear at the end of it and i want that as a loop or for a really long time. Imaginelt could you show me what you were talking about please.

Offline

 

#8 2012-08-14 10:51:12

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Here is another way of saying it. I want it to scroll like the iphone game run stick run. My character stays in the same place but the stage moves/scrolls. basically all i need now is the script to have the stage scroll. Also can i have help having gravity work and the platfroms being solid and if he's touching red the game is over? Sorry for asking so much.

Offline

 

#9 2012-08-14 10:52:50

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

If it can scroll back, you'll need a list.

when gf clicked
set [scrollx v] to [0]
delete (all v) of [terr v]
repeat (10) //How long you want it to be.
 add (pick random (1) to (5)) to [terr v]
end
add (item (1 v) of [terr v]) to [terr v]
forever
 clear
 set [counter v] to [1]
 switch to costume (item (counter) of [terr v])
 go to x: ((scrollx) + ((480) * ((counter) - (1)))) y: (0)
 stamp
 change [counter v] by (1)
 ^^ repeat the above 4 blocks 10 times, so that they are played 11 times ^^
 if <key [right arrow v] pressed?>
  change [scrollx v] by (-1)
 end
 if <key [left arrow v] pressed?>
  change [scrollx v] by (1)
 end
 if <(scrollx) < ((-480) * (10))>
  set [scrollx v] to [-1]
 end
 if <(scrollx) > [-1]>
  set [scrollx v] to (((-480) * (10)) + (1))
 end
end


http://i50.tinypic.com/312u714.jpg

Offline

 

#10 2012-08-14 10:58:36

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

BirdByte wrote:

If it can scroll back, you'll need a list.

when gf clicked
set [scrollx v] to [0]
delete (all v) of [terr v]
repeat (10) //How long you want it to be.
 add (pick random (1) to (5)) to [terr v]
end
add (item (1 v) of [terr v]) to [terr v]
forever
 clear
 set [counter v] to [1]
 switch to costume (item (counter) of [terr v])
 go to x: ((scrollx) + ((480) * ((counter) - (1)))) y: (0)
 stamp
 change [counter v] by (1)
 ^^ repeat the above 4 blocks 10 times, so that they are played 11 times ^^
 if <key [right arrow v] pressed?>
  change [scrollx v] by (-1)
 end
 if <key [left arrow v] pressed?>
  change [scrollx v] by (1)
 end
 if <(scrollx) < ((-480) * (10))>
  set [scrollx v] to [-1]
 end
 if <(scrollx) > [-1]>
  set [scrollx v] to (((-480) * (10)) + (1))
 end
end

I'm realy sorry but I'm new to this and none of that makes any sense to me. Could you please explain how it works? Also i tried to make a script like that but i couldn't find the dark orange blocks. Also is there a simpler way of doing that? Thanks.

Offline

 

#11 2012-08-14 11:09:46

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

BirdByte wrote:

If it can scroll back, you'll need a list.

when gf clicked
set [scrollx v] to [0]
delete (all v) of [terr v]
repeat (10) //How long you want it to be.
 add (pick random (1) to (5)) to [terr v]
end
add (item (1 v) of [terr v]) to [terr v]
forever
 clear
 set [counter v] to [1]
 switch to costume (item (counter) of [terr v])
 go to x: ((scrollx) + ((480) * ((counter) - (1)))) y: (0)
 stamp
 change [counter v] by (1)
 ^^ repeat the above 4 blocks 10 times, so that they are played 11 times ^^
 if <key [right arrow v] pressed?>
  change [scrollx v] by (-1)
 end
 if <key [left arrow v] pressed?>
  change [scrollx v] by (1)
 end
 if <(scrollx) < ((-480) * (10))>
  set [scrollx v] to [-1]
 end
 if <(scrollx) > [-1]>
  set [scrollx v] to (((-480) * (10)) + (1))
 end
end

I'm realy sorry but I'm new to this and none of that makes any sense to me. Could you please explain how it works? Also i tried to make a script like that but i couldn't find the dark orange blocks. Also is there a simpler way of doing that? Thanks.

A longer script might be easier for you to understand. Compressing scripts make them more complicated. It took me a while to get it too, so don't worry.
The dark orange blocks are list blocks -- same place as variables, just click "create new list."  smile
If you're wondering why I used 480 in that so much, the reason is that it is the width of the scratch screen -- and your scrolling sprites.
It's hard to explain, so just think about it; eventually it'll flood in, and you will be enlightened.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#12 2012-08-14 11:40:33

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Sorry BirdByte but i tried that and it worked but i want the stage to scroll not the sprite. Like the game Run Stick Run for i phone my sprite other than jumping stays in the same place the whole time. i want the background to scroll and pick a random background at the end of each one. I guess  I'm not being specific enough.

Offline

 

#13 2012-08-14 11:41:30

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

Sorry BirdByte but i tried that and it worked but i want the stage to scroll not the sprite. Like the game Run Stick Run for i phone my sprite other than jumping stays in the same place the whole time. i want the background to scroll and pick a random background at the end of each one. I guess  I'm not being specific enough.

I know. You need a separate sprite for the terrain.


http://i50.tinypic.com/312u714.jpg

Offline

 

#14 2012-08-14 11:48:30

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

I'm sorry for wasting your time but i really don't get it. So your saying i need to make a new sprite? Really sorry for being so slow at all this, i made my account and downloaded scratch yesterday. I think i just need more help processing how this all works. DX

Offline

 

#15 2012-08-14 11:54:50

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

I'm sorry for wasting your time but i really don't get it. So your saying i need to make a new sprite? Really sorry for being so slow at all this, i made my account and downloaded scratch yesterday. I think i just need more help processing how this all works. DX

I admire your eagerness, but maybe making a platformer isn't the best way to get started with Scratch... maybe try making a non-scrolling platformer or a Pacman remake?

Anyway, you know what a sprite is, right? For basic info like this I usually refer people to the wiki -- here. Make a new sprite and load your 5 terrains into the costumes, and use my earlier script in that sprite.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#16 2012-08-14 12:02:33

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Oh so your saying that my Backgrounds are just sprites? Ok now I understand better.And this isn't my first project/ i have one called th marshmallow chronicles but it's on my schools account. So do i need to make a sprite named anything and if so how do i name it. And thank you for being so patient with me.

Offline

 

#17 2012-08-14 12:06:59

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

Oh so your saying that my Backgrounds are just sprites? Ok now I understand better.And this isn't my first project/ i have one called th marshmallow chronicles but it's on my schools account. So do i need to make a sprite named anything and if so how do i name it. And thank you for being so patient with me.

It doesn't matter what it's name is. You can change the sprite name in the panel above where you put the scripts.

Oh, and no problem! ^_^ Programmers are usually very patient people. XD


http://i50.tinypic.com/312u714.jpg

Offline

 

#18 2012-08-14 12:09:02

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Ok working on the "backgrounds". How do i get my main sprite to show ontop of the other one.

Offline

 

#19 2012-08-14 12:14:42

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

Ok working on the "backgrounds". How do i get my main sprite to show ontop of the other one.

Just use this block:

go to front
It's in Looks.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#20 2012-08-14 12:15:33

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Thanks and now i copy that huge script into my background sprite right?

Offline

 

#21 2012-08-14 12:20:10

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

Thanks and now i copy that huge script into my background sprite right?

Right.  wink


http://i50.tinypic.com/312u714.jpg

Offline

 

#22 2012-08-14 13:00:09

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

Well there still seems to be something wrong so i uploaded it. Can you look at it  and tell me what you think is wrong with it?

Offline

 

#23 2012-08-14 13:07:54

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

Ep1cMarshmallow wrote:

Well there still seems to be something wrong so i uploaded it. Can you look at it  and tell me what you think is wrong with it?

Sure. Can you link me to it? I can't see it on your user page.


http://i50.tinypic.com/312u714.jpg

Offline

 

#24 2012-08-14 13:09:29

Ep1cMarshmallow
New Scratcher
Registered: 2012-08-13
Posts: 17

Re: infinite scrolling platform game

http://scratch.mit.edu/projects/Ep1cMarshmallow/2729712
Gain sorry for being so needy, I just don't know what I'm doing wrong.

Offline

 

#25 2012-08-14 13:14:17

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: infinite scrolling platform game

BirdByte wrote:

Ep1cMarshmallow wrote:

Well there still seems to be something wrong so i uploaded it. Can you look at it  and tell me what you think is wrong with it?

Sure. Can you link me to it? I can't see it on your user page.

nvm, found it.
You want to make sure that your terrains have transparent backgrounds -- that's the checkered gray -- so that they don't overlap. Zoom out using the zoom selection next to the color selector and grow your sprites until it fits the painting area using the buttons on the top left of the paint editor.  smile  You'll need to add sensing as well, but I'm not good at explaining that at all, so you'll need to ask somebody else.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

Board footer