Hey Guys! This Is A Tutorial For A Platformer Game! If your a beginner to Makecode this could help! Lets Dive in!
STEP 1: EXTENSIONS
Now, there is A built in Platformer Extension (Corgio) , but I’m gonna be doing this from scratch!
Honestly, I have no recommended extensions!
STEP 2: THE PLAYER
first We are going to MAKE the player! Put all of this in ON START
- First Go to Sprites
- Under Create: go to set mySprite (dont rename to the player make it more easy)
- Make any Image!
- (IMPORTANT) Set your kind to PLAYER Its Saves alot of time and stress!
Next, We are going to set the player gravity!
- Under PHYSICS: go to set MySprite x
- Click the X
- Change The X to AY (accelration Y)
- If your aiming for A Low Gravity platformer I recommend Setting it To 150 - 200, If your going for the harder HIGH GRAVITY platformer, set it to around 300 - 500!
Now Test The Game! See how they just fall through the floor?
Fix it by doing this!
- Go to Scene
- Go to the CAMERA
- Select camera follow MySprite
- Attach it to ON START (IMPORTANT: Do not place it BEFORE the other blocks you have put!)
NOW WE HAVE A CAMERA THAT FOLLOWS THE PLAYER
But now It looks like he’s falling Forever. Dont Worry! We’ll change that later!
This Segment Is Where We Create A BACKROUND And A LEVEL!
First lets create the Backround!
- Select SCENE
- Under Screen Select SET BACKROUND IMAGE (Set Backround Color Is fine as well!)
- Create Or Use any of the pre-made backrounds!
- Place In ON START
Now lets Create…(Drum roll Please)… A LEVEL!!!
- Select Scene (once again)
- Under Tilemaps Select Set Tilemap to
- Place in ON START
- This May look scary at first but soon, Youll be better than me at making levels!
- Bottom 2 numbers (Usually 16’s) = TILEMAP WIDTH & HEIGHT
- Pencil = drawing blocks!
- Eraser = erase blocks
- 3D Cube looking thing = Add Walls! (IMPORTANT You need to add walls for Collision)
Now we have a level!
To place a sprite on top of a spot you need to look at your tilemap!
Look at where you want the start to be!
- Go to scene
- Go to tilemap operations
- Select Place MySprite on top of (col, row)
Remember The 16 by 16 numbers I mentioned earlier?
The Col is the first one and the Row is the second!
This Is where we make Movement And Jumping!
- First go to CONTROLLER
- Next go to SINGLE PLAYER and select Move MySprite with buttons!
- Put it in ON START
There are 2 numbers: X (first) and Y (second)
- Set the X to whatever you want But ALWAYS set the Y to 0
NOW YOU CAN MOVE!
next, Lets add jumping!
- go to Controller
- in Single player Add On A Button Pressed!
- Set the button to anything you want!
This is the harder part!
- Next, Go to LOGIC
- add an IF statement
- Put it in The A Button Pressed
- go to Scene
- Scroll To the End Until you see If MySprite Is Hitting Wall Left
- Where it says True In the IF Statement Put the Hitting wall there!
- Change LEFT To BOTTOM
Now It will Only Run When Your touching the ground!
- Go to Sprites
- Go To change MySprite X by
- Change The X to vy (velocity Y)
- Set It to any Negative Number between - 150 and - 400!
BOOM! Platformer Basics Done!
Your Project Should Look Something like this!
We’ll Add Effects and Enemies NEXT TIME!