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

#1 2012-03-15 20:02:07

ftf841
Scratcher
Registered: 2012-02-19
Posts: 1000+

platformer help

can anyone give me some tips to create a platformer ?


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Hi+there./mca.png
http://mag.racked.eu/mcimage/i354/Achievement++get%21/CAKE%21%21%21%21%21/mca.png

Offline

 

#2 2012-03-15 20:33:48

itsmomito
Scratcher
Registered: 2008-03-28
Posts: 100+

Re: platformer help

Sure!

Platformers are actually really easy to make, once you get the concept. I actually never knew how to and I eventually figured out. The main thing in a platformer is scrolling, i will explain that to you and more if you would like:

So the scrolling in a platformer is basically just 2+ images the size of the entire screen that seem as if they are connected. To make them scroll along side each other, you need to know the full length of the screen which is 480 in scratch. Now you know the length, how will they go side by side? Well, when you create a sprite the size of the screen, the x position will be set to 0. So the Sprite covers the screen at x 0. We will set the x position of the first image to be 0. The second image needs to be to the right of that image, so it will be the x position of image 1 + 480. The third image will be the x position of image 1 + 480 * 2 and so on. That is all there is to it! So to actually put this in work and test it:

1) Make a variable called ScrollX, this will be to move the images back and forth in the screen

2) Make three sprites that fill up the screen, maybe three colors (Red, Blue, and Black)

3) Create this script for the first image you choose, I chose red:

When Flag Clicked
      Forever
            Set X Position to ScrollX
      end

4) Okay, make this for the next image, I chose Blue

When Flag Clicked
      Forever
            Set X Position to ScrollX + 480
      end

5) Now make this for the final image, I chose Black

When Flag Clicked
      Forever
            Set X Position to ScrollX + (480 * 2)
      end

6) Now make a script to control the movement of the three screens.

When Left Key Pressed
      Change ScrollX by 3
end

When Right Key Pressed
      Change ScrollX by -3
end

Okay, those are the basics. (Sorry I just got back on scratch, I dont know how to use scratch blocks.) Test it out! It works right? In a platformer, you would replace the color images with separate backgrounds. If you wanted to loop back when you reach the end of the third image, you just have to reset the scroll x. Thats all! Everything else is pretty easy. The character actually stays in the same position, the only changes he makes depends on the type of platformer. If you would like more, just ask!  smile  Here is a platformer i made: http://scratch.mit.edu/projects/itsmomito/1120339

Offline

 

#3 2012-03-15 20:43:37

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: platformer help

Not all platformers use the scrolling method. Some of the best I've seen stay on the x,y grid and don't try to make it bigger. To make a platformer, everybody likes realistic gravity like found here. For arrow key movement look at this forum. For jumping look here. And if you still don't know what to do, check out a scripting tutorial index found here.


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#4 2012-03-15 21:18:07

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: platformer help

itsmomito wrote:

Sure!

Platformers are actually really easy to make, once you get the concept. I actually never knew how to and I eventually figured out. The main thing in a platformer is scrolling, i will explain that to you and more if you would like:

So the scrolling in a platformer is basically just 2+ images the size of the entire screen that seem as if they are connected. To make them scroll along side each other, you need to know the full length of the screen which is 480 in scratch. Now you know the length, how will they go side by side? Well, when you create a sprite the size of the screen, the x position will be set to 0. So the Sprite covers the screen at x 0. We will set the x position of the first image to be 0. The second image needs to be to the right of that image, so it will be the x position of image 1 + 480. The third image will be the x position of image 1 + 480 * 2 and so on. That is all there is to it! So to actually put this in work and test it:

1) Make a variable called ScrollX, this will be to move the images back and forth in the screen

2) Make three sprites that fill up the screen, maybe three colors (Red, Blue, and Black)

3) Create this script for the first image you choose, I chose red:

when gf clicked
      forever
            set x to (ScrollX)
      end
4) Okay, make this for the next image, I chose Blue
when gf clicked
      forever
            set x to <(ScrollX) + [480]>
      end
5) Now make this for the final image, I chose Black
when gf clicked
      forever
            set x to <(ScrollX) + <[480] * [2]>>
      end
6) Now make a script to control the movement of the three screens.
when gf clicked
if <(left v) key pressed?>
      change (ScrollX) by [3]
end
when gf clicked
if <(right v) key pressed?>
      change (ScrollX) by [3]
end
Okay, those are the basics. (Sorry I just got back on scratch, I dont know how to use scratch blocks.) Test it out! It works right? In a platformer, you would replace the color images with separate backgrounds. If you wanted to loop back when you reach the end of the third image, you just have to reset the scroll x. Thats all! Everything else is pretty easy. The character actually stays in the same position, the only changes he makes depends on the type of platformer. If you would like more, just ask!  smile  Here is a platformer i made: http://scratch.mit.edu/projects/itsmomito/1120339

Fixed it a bit!

Last edited by joletole (2012-03-15 21:20:51)

Offline

 

#5 2012-03-15 22:08:36

itsmomito
Scratcher
Registered: 2008-03-28
Posts: 100+

Re: platformer help

joletole wrote:

itsmomito wrote:

Sure!

Platformers are actually really easy to make, once you get the concept. I actually never knew how to and I eventually figured out. The main thing in a platformer is scrolling, i will explain that to you and more if you would like:

So the scrolling in a platformer is basically just 2+ images the size of the entire screen that seem as if they are connected. To make them scroll along side each other, you need to know the full length of the screen which is 480 in scratch. Now you know the length, how will they go side by side? Well, when you create a sprite the size of the screen, the x position will be set to 0. So the Sprite covers the screen at x 0. We will set the x position of the first image to be 0. The second image needs to be to the right of that image, so it will be the x position of image 1 + 480. The third image will be the x position of image 1 + 480 * 2 and so on. That is all there is to it! So to actually put this in work and test it:

1) Make a variable called ScrollX, this will be to move the images back and forth in the screen

2) Make three sprites that fill up the screen, maybe three colors (Red, Blue, and Black)

3) Create this script for the first image you choose, I chose red:

when gf clicked
      forever
            set x to (ScrollX)
      end
4) Okay, make this for the next image, I chose Blue
when gf clicked
      forever
            set x to <(ScrollX) + [480]>
      end
5) Now make this for the final image, I chose Black
when gf clicked
      forever
            set x to <(ScrollX) + <[480] * [2]>>
      end
6) Now make a script to control the movement of the three screens.
when gf clicked
if <(left v) key pressed?>
      change (ScrollX) by [3]
end
when gf clicked
if <(right v) key pressed?>
      change (ScrollX) by [3]
end
Okay, those are the basics. (Sorry I just got back on scratch, I dont know how to use scratch blocks.) Test it out! It works right? In a platformer, you would replace the color images with separate backgrounds. If you wanted to loop back when you reach the end of the third image, you just have to reset the scroll x. Thats all! Everything else is pretty easy. The character actually stays in the same position, the only changes he makes depends on the type of platformer. If you would like more, just ask!  smile  Here is a platformer i made: http://scratch.mit.edu/projects/itsmomito/1120339

Fixed it a bit!

Thanks a lot!

Offline

 

#6 2012-03-16 18:40:50

ftf841
Scratcher
Registered: 2012-02-19
Posts: 1000+

Re: platformer help

itsmomito wrote:

joletole wrote:

itsmomito wrote:

Sure!

Platformers are actually really easy to make, once you get the concept. I actually never knew how to and I eventually figured out. The main thing in a platformer is scrolling, i will explain that to you and more if you would like:

So the scrolling in a platformer is basically just 2+ images the size of the entire screen that seem as if they are connected. To make them scroll along side each other, you need to know the full length of the screen which is 480 in scratch. Now you know the length, how will they go side by side? Well, when you create a sprite the size of the screen, the x position will be set to 0. So the Sprite covers the screen at x 0. We will set the x position of the first image to be 0. The second image needs to be to the right of that image, so it will be the x position of image 1 + 480. The third image will be the x position of image 1 + 480 * 2 and so on. That is all there is to it! So to actually put this in work and test it:

1) Make a variable called ScrollX, this will be to move the images back and forth in the screen

2) Make three sprites that fill up the screen, maybe three colors (Red, Blue, and Black)

3) Create this script for the first image you choose, I chose red:

when gf clicked
      forever
            set x to (ScrollX)
      end
4) Okay, make this for the next image, I chose Blue
when gf clicked
      forever
            set x to <(ScrollX) + [480]>
      end
5) Now make this for the final image, I chose Black
when gf clicked
      forever
            set x to <(ScrollX) + <[480] * [2]>>
      end
6) Now make a script to control the movement of the three screens.
when gf clicked
if <(left v) key pressed?>
      change (ScrollX) by [3]
end
when gf clicked
if <(right v) key pressed?>
      change (ScrollX) by [3]
end
Okay, those are the basics. (Sorry I just got back on scratch, I dont know how to use scratch blocks.) Test it out! It works right? In a platformer, you would replace the color images with separate backgrounds. If you wanted to loop back when you reach the end of the third image, you just have to reset the scroll x. Thats all! Everything else is pretty easy. The character actually stays in the same position, the only changes he makes depends on the type of platformer. If you would like more, just ask!  smile  Here is a platformer i made: http://scratch.mit.edu/projects/itsmomito/1120339

Fixed it a bit!

Thanks a lot!

actually I need help on sensing the ground.


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Hi+there./mca.png
http://mag.racked.eu/mcimage/i354/Achievement++get%21/CAKE%21%21%21%21%21/mca.png

Offline

 

#7 2012-03-16 19:05:16

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: platformer help

For the ground sprites

when gf clicked
forever
if <not<<jumping?>=[1]>>
if <touching [player v]?>
set [touching player? v] to [1]
end
if <not<touching [player v]>>
set [touching player? v] to [0]
end
The "touching player?" is a variable
The "jumping?" is shown in a script below

Put this under the player

when gf clicked
forever
if <not<<jumping?>=[1]>>
if <<touching player?>=[0]>
change [Gravity v] by [-0.1]
end
if <<touching player?>=[1]>
set [Gravity v] to [0.01]
end
change y by <Gravity>
"Gravity" to make it simulate actual gravity, it will be bouncing a little bit.

when gf clicked
forever
if <key [up arrow key v] pressed?>
set [jumping? v] to [1]
set [Gravity v] to [10]
repeat until <<touching ground?>=[1]>
set [Gravity v] to <<Gravity>*[0.98]
change y by <Gravity>
end
end
If there's anything wrong with the scripts please fix it. I have never actually put gravity into my game.

Last edited by MaxFlyboy (2012-03-16 19:07:16)


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

Board footer