< User:Cool-d1234

What is a Platformer

This will teach you how to make a platformer, a platformer is a game where a player jumps from platform to platform to get somewhere (portal or something like that.)This will also teach you how to create a moving player for your project.

Step 1: Making a Player

This is a simple way of how to keep the player from falling off the platform and create a spawn point( where it goes to when the flag is clicked.).

when flag clicked
go to x(0) y(0)
forever
if (touching color [#000000])          
change y by (10)
end
if (not(touching color [#000000]))
change y by (-10)

This way your player won't fall off the platform, but your player can still partially go through walls. Next you should make it able to move. If you want it to be really simple use the move ten step block:

This is for moving right:

when green flag clicked                     
forever
if <[right arrow v]key pressed>
point in direction (90)
move (10) steps
wait (0.001) secs

This is for moving left:

when green flag clicked                     
forever
if <[left arrow v]key pressed>
point in direction(-90)
move (10) steps
wait (0.001) secs
end

This is for jumping

when green flag clicked
forever
if <[up arrow v]key pressed?>
point in direction (90)
move (20)steps
wait (0.1) secs
move (20) steps
wait (0.1) secs
move (-20) steps
wait (0.1) secs
move (-20)steps

Step 2: Making a Platform

Now all you need is a platform.

First draw a platform in you background section and make sure the player can fit through the spaces. Remember to also make sure the player won't spawn in the platform! That will cause it to get stuck!

Adding Levels

If you think that it is too simple you can add levels. To do that you must create a variable called levels ( you can name it whatever you want but I used the name levels.) Then you must make many more platforms in background. Put the platforms in the order you would like them to be in. After that you have to program the background costume number to equal levels:

when green flag clicked
forever
switch backdrop to (levels)

To make the player go to the next level you must put a certain color in your platform so when the player touches it, it takes it to the next level and remember put in a go to x( ) y( ) to set its position when it goes to the next level. Program the player this:

when green flag clicked 
set [level v] to [0]
forever 
if (touching color [#6865])
change [level v] by (1)
Go to X(0) y(0)
wait (0.5) secs

If you want the platformer to end at the last level , find what costume you want it to stop and program it to stop at that level! Program the player this to do that ( fill in the fiftheen with your number you want it to end at!):

when green flag clicked
forever
if ((level)=(15))
say [you win!!]
stop [all]

References