Make Facebook Instant Games with GameMaker Studio 2 | Gurpreet Singh Matharoo | Skillshare

Make Facebook Instant Games with GameMaker Studio 2

Gurpreet Singh Matharoo, GameMaker Mentor and Instructor

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
29 Lessons (1h 20m)
    • 1. A1 - Promo

      1:07
    • 2. A2 - Introduction to GameMaker

      4:53
    • 3. B1 - Project

      0:50
    • 4. B2 - Car Movement

      3:28
    • 5. B3 - Road Background

      1:42
    • 6. B4 - Score

      1:49
    • 7. B5 - Traffic

      3:49
    • 8. B6 - Car Collisions

      3:21
    • 9. B7 - Fuel Bar

      2:22
    • 10. B8 - Fuel Pickup

      2:43
    • 11. B9 - Game Menu

      3:02
    • 12. B10 - Game Over

      2:39
    • 13. B11 - Music & Sounds

      2:28
    • 14. C1 - Facebook App

      1:03
    • 15. C1.5 - Small Changes

      1:10
    • 16. C2 - Our Instant Game

      3:50
    • 17. C3 - High Score: Part 1

      5:17
    • 18. C3.5 - High Score: Part 2

      1:02
    • 19. C4 - Sharing

      3:35
    • 20. C5 - Updates

      2:03
    • 21. C6 - Ads: Part 1

      2:02
    • 22. C7 - Invites

      2:33
    • 23. C8 - Ads: Part 2

      2:37
    • 24. C9 - Leaderboard Data

      3:29
    • 25. C10 - Leaderboard UI

      9:52
    • 26. C11 - Leaderboard Scrolling

      2:54
    • 27. C12 - Leaderboard Bug

      0:46
    • 28. C13 - Ad Update

      2:22
    • 29. C15 - Publishing

      0:58

About This Class

Hey there!

I'm Gurpreet Singh, your GameMaker instructor.

The focus of this class is to create a game for the Facebook Instant Games platform.

Who am I?

I've been using GameMaker for the past 5+ years. I started creating GameMaker courses and tutorials in 2015, and have never stopped since!

Along with Udemy courses, I also create YouTube tutorials on my channel (GameMakerStation), and have tons of tutorials on my blog (GameDev Palace). I love game development, and I want to share the fun with you!

What is Instant Games?

Instant Games is a platform that allows developers to create HTML5 games that can be played in the browser, or on mobile, using the Messenger app.

It's a fairly recent platform, and was opened to all developers in early 2018.

Instant Games can make use of social features such as sharing, leaderboards, and chat to create games that are interactive in more ways than traditionally possible.

It also supports ads, so developers can earn a profit from people playing their games.

Please note that as of now, you need to be in the Apple Developer Program to publish Instant Games, which costs $99/year.

Why should you take this class?

In this course we use GameMaker Studio 2 to make our game, and some simple JavaScript to implement the Facebook Instant SDK.

GameMaker Studio 2 is a game engine that makes it very easy to make 2D games. The programming language used in this game is called GameMaker Language and it's really simple to use.

So while you will be learning how to make games for Facebook Instant, you'll also be learning a lot about GameMaker Studio and GameMaker Language.

Which means that the skills that you gain from this course can also be used to create games for other platforms, such as PC, mobile, web, and consoles.

What do you need?

You can start working on the game right away with any version of GameMaker Studio 2 (even the trial, although that will limit how much progress you can make on the game).

To compile the game for HTML5, however, you will need GameMaker Studio 2 Web.

That is all you need to create a professional Facebook Instant game with GameMaker!

So join in now, and let's get started!

Transcripts

1. A1 - Promo: Hey there, I'm group re saying your game occur. Instructor in this course will be focusing on creating off his vocation game. Instant games is a platform that allows developers to create STM in five games that can be played in the browser or on mobile using the messenger app. In this course, we use game maker Studio to make our game and some simple JavaScript to implement the Facebook Internet geek a gamemaker should go to is a game engine that makes it very easy to make duty games. The programming language using this engine is called chemical language, and it's really simple to use. So while you will be learning how to make games for Facebook, Instant will also be learning a lot about gimmick, a studio and chemical language. So the skills that you gain from their scores can also be used to create games for the platform's any version of gamemaker studio to will work for starting out. But to compile the game as a steamer five, you need a version off gamemaker, so join in and I'll see you in the course 2. A2 - Introduction to GameMaker: Hey there, in this lecture, I'll give you a basic introduction to again. Make sure you do and how it works if you already know the basics. The new miscarriages lecture. After starting gamemaker, you can click here to create a new project. Now you can select whether you want to create the game using drag and drop or by according with chemical language, for discourse abusing the latter. So I click here. No, your project has been created and opened. This is a workspace, and this is a resource. Is bar you'll be creating resource is to build your game. They're created and listed here while they're added and builds here for creating Are you source. You can hardly cornets folder and select this option. The basic workflow off getting a game and gamemaker goes like this. You make us pride, the nuclear an object for that's right, and then you place that object in a room. Now let me explain the steps one by one, a sprite is an image that is used for an element in a game. For example, you can have us pride for a player, a coin ah, house and so on. It can also be an animation with multiple images or sub images. An object is word and compresses all the logic and behavior often element in a game, so you can create an object with a player, sprite and quarter to move, jump and attack all inside the object. A room is like a level of the game where you can place the objects, and that is how they appear in the game so you can create multiple rooms if you want more than more levels. Now, let's go back to the objects I told you that you can call the logic and behaviour often object. But how does it work to make it easy to understand when Sergeant court should run on the court inside, an object is divided into separate events. You can add any events from this big list of events to run court at certain times. For example, if I had the creative end, the quarter right here will run only once. When the audit starts working, the step element is the minimum it because it runs all the time, once were frame. So, for example, you can call the movement and the rest of the behavior here the droid mint is just like the temperament, but it's used to draw things like a Sprite, Ah, health bar and so on. Then their money conditional events as well that run when something specific happens. So the keyboard events run when some key is pressed. Duck clear, never concerned when disrupted, collides with someone an object and so on. You can herd cordons hard these events using G. M. L or chemical language. Let me explain the basics off. Courting is in G M L. Oh, very able is used to store of value. So in the creative meant I can create a very able called A and 32 5 You can give any name or value to ever able in the dry vent. I'll draw this value using the drawbacks function. This is a position where they really will be drone, and this is a value to draw. I'll place the objects in the room and run the game. You can see that it chose five here, which is a value off a now will open the step event and here type A plus equals one. This means that the every able should be increased by one each step because of the blast symbol before the equal sign. Now, if I run the game, you can see that the value keeps increasing. Since we put the court in the step event, it increases once per frame. The default speed off a game, a star difference per second so they were able is going up by 32nd functions are used to perform some action, for example, have used a door text function. Here we draw some text each function used to have these parentheses at the end. Depending on the function, it may require some data to be able to perform it section, just like the DOT exe function requires a during position and devil you to draw depending on the function. It smells horrid on a value that you can store inside a very able soil. Open that a parent and tied this year, the function, her own drones, a number and her don's a result. So the function would round 2.8 to 3 and it earn it data. It on value would be stored in this variable called B, so the value of B will become tree if conditions let you run some called only at specific times when starting conditions are met in the step even allowed this. This is really simple. If musical 23 it was set a 20 So, basically, if the conditioner than here is true, then the court inside these records will run. We know that B is three, right? So it will be side 20 in conditions of use. Diabolical signs to check with the two values are equal, while views a single equal sign when assigning a value to ever able. No, If I run the game, you see that is value appears at zero because of the condition. If I change the condition to check whether bees four, you'll see that is nor effected at all because their condition becomes false and discord does not run. So they're sold for the introduction. No, let's start working on our game. 3. B1 - Project: here in this section will be working on our game before adding Facebook Astarte creatures in the next section. So here I have gamma kosher to open. I've local new onslaught gamemaker language. I learned this project at the instant. No, the project has been created. I'll create astride an image s player, likely going import and import the card image for the player I said the origin to middle center The origin is the point use for dating an object. So we wanted to rotate from the center aisle, open the Christian must menu and said this a rectangle with tradition. This will make sure that the collisions work properly. When the car is audited, you can download all the sprites and the sources using the scores by going toe that he's also section of this lecture on downloading that file. So let's continue to the next lecture. Were record a car movement 4. B2 - Car Movement: Hey there in this lecture will make the car movement. We'll be creating two objects or manager, and a player or manager will manage. Stinks like creating the cars in port and so on. Or player. Regrettably, a scar or manager. Recreate Oh player in the room and get a mouse or touch import or player builder news that input to move. So that's got Do it. I'll create a two objects here or manager and Opare before it in code. I need to start something's up. Soil. Open the room and go to the settings here outside the room, size to turn 20 by two. Allergy, which will be our base resolution. Now we'll go to options and open main, you know, change the game speed of 60 sort will learn at 60 FPs inside of 30. Making the game a lot. Most moods. Now we'll open or manager healer the create event inside your dollar. This this is a horizontal position of the car in the room, which is a room where it's multiplied by 0.5 so far, is only it will be in the center. This is the vertical position off the car. We should be at 85% of the rooms high. So it'll being at the bottom and storing these values into these local vari ables created using bar local variables are temporary that lead when the event ends here. The car object has been created at these coordinates inside this layer, so this court will create a car object inside the room. No wonder the begin step event now, other discord here that begins Step event runs before the separate, so it's a good place to get old input before using it in the step event. This part stores the mostest X and Y coordinates into global variables. Global variables can be accessed by all the objects, so it makes sense to use those for the input variables. We're doing this so that if we ever need to change how the most input is received, we could just change it here. This guess whether the left most button is being held. This also works for those devices now will open or player. I've look here to assign the cars pride to this object. No wonder the create event. I'll create a variable here distance homer the cartons when it has to move so you can change its value to change the turning speed. No alert The step event and heard. This year, dis condition will check whether the most modern is being held. If it is being held than this court, we run using the lab function. You can smoothly move a value to a target value if you use it like this. So I'm moving the instances X to the mosque is X explanation for the lower function will be in the next lecture So this very the car will move. Now let's get to the relation. This very able will get a distant toe the mouse. So first it will subtract most X from X and divided with room for it to normalize it. Then it will multiply the result. We turn him out and set it to image angle, which is a rotation of the object. This part will run if the mouth is not held In that case, the angle degrees set to zero now will open the room and play. So manger here, then run the game. You can control the car with the mouse and it looks really sport. No, let's move on to the next lecture. We really the road background 5. B3 - Road Background: Hey there. In this lecture we let the road background the road background. We constantly be going downwards. Saturday Looks like the car is going forward. So let's get to it. He and I have added that or is bright now will open the room and slick the back on layer from here. Heroes like damage. You can see it appears in the room, but it doesn't feel it. So high level political trial from here. Nobody to make it, Move it. Court soil, Open Levenger. In the creative and other days, these variables tell how far the car should move since the car object isn't actually moving . But the background is scrolling will use These were Ables to scroll the background this variable who stole the current speed of the car which starts at two. This is the maximum speed and this is the car's acceleration. This amount will be added to the speed each step until it reaches a maximum speed. Now will open the begin chap parent and our this here. This will get the light position off the background layer in the room. Then using this function, it will be changed to this value where the car speed is being area to the backgrounds y position. So this fit a background will go down with the car speed. Know that this is a name of the layer and it should match with the layers Name in the room here. Disconnection checks whether the car speed is Lord and the Max speed. If it is, it'll increase the car speed by the acceleration. No, we learned the game and you can see that it looks like the cars moving. It starts slow and then it gets faster. No, no, it's continue to the next lecture. Reveal it, auditors counter. 6. B4 - Score: Hey there in this lecture related the distance counter. First of all, I'll create a new phone for the Heard Our coldest FT hurt. I select a phoned and said the size to 60 now will open or manager on in the creative and alert this this variable restore home in defeat. The car has traveled. No wonder the step imminent. And here, like this, the feet very able will be increased by the car speed divide by 20 so that it doesn't increase too fast. Now we'll at the Giorgio event. This event is used for drawing hard elements so that they appear at the door. So here, like this, this was her. The phone to the Von vacated earlier displays had attacks horizontal alignment to write desperate or feet value at disposition. You can see the times attracting a value from the room where it so that the text appears on the right side of the window. This is a text that will be drawn force. It will run defeat value, then converted into a string. And then they're dis text at the end. Then the horizontal alignment off the tax Blueberry said back to left. No. If you're on the game, you can see that that extra peers here, but it blends in with their old stripes. So to fix this we need to draw a shadow after the function. That said the alignment to write I let this this one said the collateral black, then draw that X. And then we said the collar to white. You can see their dysfunction is mostly the same as the one below. The difference is that the shadows accent my coordinators have been increased by four pixels each. Also, the shadow is being drawn before the text. So there appears below it. No, if you run the game, you can see that it looks a lot better with the shadow. No, let's move on to the next lecture. 7. B5 - Traffic: Hey there in this lecture will implement a traffic before we start. Let me explain what areas are a very able stores. Only one value, but in a rake and store multiple values. Just add a number inside square brackets after the variable name and it becomes an array. Then you can store as many values as you want, all using a single name. So this is what goes into the first Lord of your A. This is what goes into the seconds Lord, and so on. You can get a value from an area in the same way. So let's go do it here. I've aborted some cars. Brides for all of them. D ord intramural center and a mask types to redact angle with rotation. Now we create an object, a name it or car which will be used for the traffic cars here alert the creativity and hard this year. This is where the speed of the car It will be a random value anywhere between six and 10. The Jews from undertones or random value from the values in the parentheses. So it will get a random stride from these and Cedatos Pride Index, which is a sprite off the object. We don't want multiple cars two sworn in the same place and got stuck. So this will check whether this car is colliding with some of the car when it is created. If a collision is found, then the scar will be destroyed. No wonder the stepparent and her. This year the car scored onwards, so we want them to be destroyed when they go out of the room. Be Bookstop is the top edge of the cars mask. So this will check whether the Topa disposition is greater than the room height, which means that it is below the rooms boundary. If it is, then I stars will be destroyed despite increased because my position Rida play a speed while subtracting the car speed from it. Discord slows down the car if there's not of on ahead. So it checks for a collision 22 pixels above the car, and if a collision is found, introduces the car speed by one. No, we'll open or manager in. The creative mint allowed this when you just your game. The random functions always returned the same value. To disable that, we need to run the randomizer function after this, all the random functions Willard owner and on values disconcert alarm zero to the room speed multiplied by two, which means two seconds. An alarm is a special event that works as a timer. So since we're setting alarm 0 to 2 seconds, that event will run two seconds after the score runs. Global Lanes is an array that stores the X coordinates off the three lanes. It will be used for the cars. No Willard alarms government allowed this year. This will selector animal in position from the lanes are a dysfunction Willard on our animal teacher between zero and two so it will select Italy and zero lane one orleon, too. This is the light position where the car will respond. Since it's a negative number, it's above the room disappeared the car a disposition, then dispenser alarm zero. So that returns again. First, it was like a random value between these values and then divided by car speed so that if the player speed is higher, the car spun faster. I divided the car speed by aid so that they don't spoon too fast. No one in the game you can see the car spawning and going tone because just load on a player's car. No need to make a small change after the car speeds up to its max speed. I wanted to keep getting faster so that the game keeps getting harder. So I opened up again. Step event. And at this year, one the car speed is small in a max speed multiplied by two. It will be increased by the acceleration. Divide by 20 so it will speed up. But right, slowly notice move onto the next lecture. 8. B6 - Car Collisions: Hey there in this lecture will implement car collisions when two cars collided, should bounce off each other and started dating so on collision. The direction between the cars will be used to set them moving in the opposite direction. So let's get to it first. Or create a new object named Oak our parent. This will be the parent objects or for player and a car, and will be used in collisions. Soil open its parent menu and drag or player, and no car under Children now will open no player and go to the create event here. Alert this. This is a horizontal speed of Dienst. Us. This is a vertical speed and this is a rotation. These wear ables will be used after the collision. This tools whether the car has crashed into another car. This is the speed at which it should move after the impact now will open the step event. After this condition, all of this and after the cells to this will make sure that I import doesn't work After the car crash is also at this year, just being VSP will be added to X and Y and wrote will be added to the image angle so that it or dates no one at all. UM zero event. And at this year, when alarmed Iran's the room we reached out. This will be used to that. The room doesn't really start immediately after a crash. Now will open oh car and go to the create event here. I learned the same variables now will open the step event, and they're the same called from a player. And no, I learned a collision, gored it starts players text for a collision with an object and returns an instance I d off my stuff that was found in the collision. Since I'm using the car parent here, the function will check for collisions with both a player and no car. If a collision is found and the car is not crashed, the falling court will run this picture acquitted. The other car is the player. By checking whether it's object Index is a player and storing the result in his player distance that grass to true disconcert speed to zero so that the cost Taub's and disciplines had both of these variables in the rest of us that was found in the collision disregarded election into the other car. This will serve these chances at SP and BSP so that it moves in the opposite direction with impact speed. One area is added to the direction to get the opposite direction. This is what the lender functions do. They take a speed, value and the direction and give you the X movement and of eye movement required to move in the direction with that speed dispenser delegation to a random value between five and 10 and then multiplied with either one or my swan to make it opposed to or negative. The same movement and rotation will be applied to the other instance. The only difference here is that vanity is not added to the direction. If the other instruments is the player that it will set the players alarm 0 to 2 seconds. Sort of the room restarts. Now open your manager and go to the beginning step event before this condition allowed and else because I need to add another condition before it. So I had this year. If the player has crashed, the car speed will be reduced to zero using blurb No. One in the game. No congressional My car into the other cars after their the room restarts notice continue to the next lecture very really added fuel system. 9. B7 - Fuel Bar: Hey there. In this lecture of will implement a fuel bar, there will be two images. This one will appear in the back and this one in the front. The back one will always be there. But the front one will change. Builds on the fuel. So it's got Do it here. I'm imported. The fuel bus Pride. It has two frames for the bar now. Well open or manager and open the create event. Here. Alert this dextrose. How much fuel we have. So one is full and zero is empty this way. Able with smoothly follow the fuel very able and will be used in the Georgie. Why event this Weigh the fuel bible appear to move smoothly now will open the begins supplement. And at this year, if the fuel is greater than zero den, it will be reduced by the Caspi divided by this value. So the fuel will be reused. Beers on the car speed else. If the fuel is zero and the pair has not crashed, it's crap story Able will be set to true Southern stops and Islam zero will be set to two seconds so that the room restarts now will open that Giorgio event and at this year, this is a pollution with a bar will be drawn here. Fuel drove this Moodley Follow the value or fuel using lower, despite all the background off the bar. Richards Force frame. No, we need to draw the second frame. Disregard, divert and hide off the fuel bar. Let's assume that the fuel is 0.6. This will multiply the height with the amount of fuel to get the hide that needs to be drawn. Dissidents objected rawhide from the high to get the hide that needs to be removed so only this part of the bar will be drawn. So here I am, drawing the fuel bar second frame here I'm defining or a triangular area inside us Pride to be drawn so it's extra zero and why we be removed. Fight. It's where it will be less price words and the height. With petrol height, it will be drawn, and the fuel bus position and remove height is added to its Why no order in the game, you can see the fuel bar here. It's going down slowly and wants it empties. The car stops and the room restarts. No, no, it's continue to the next lecture reveal. Add fuel pickups 10. B8 - Fuel Pickup: Hey, there in this lecture will air fuel the cubs I've imported. The fuel becomes prides. Make sure its origin is real. Center now will create or fuel answered as bright under the creative Arent honored this year, the stores What did the player has taken the fuel pickup or not know whether the step refinement and her this year, If the player has not taken a few, it's why we've increased by the car speed. So it'll just go with the road. If the player has not taken the fuel and the fuel is clouding with a player taken will be set to true Few, which is a very able off for manager, will be increased by this value, so it'll only add a little bit off fuel. If the fuel goes above one, which is the maximum value, it will be set back to one. Then, if the player has taken a few actually animate and move to the fuel bar, so it's X scale will be reduced by this value, and the voice scale will be said to deck scale. This way it will keep getting smaller. Same were the alpha be reused districted election towards the fuel boss position than using the lender functions. It removed honest us in that election with 16 speed and one day, Mitchell Fargo's below zero dying stars will be destroyed, and the stars will also be destroyed. If it goes below, the room now will open or manager and go to the create event here that this descent Salam one to once again. And this variable shows the expedition where the previous fuel pickup was created. No wonder the alarm when you weren't honored this year, dismiss a devolution where the fuel will be created, just like Ridin Lum zero for the cars here. If the previous exploration is North zero and just random condition ordinance through the current explanation will be said to the previous expedition this weird. The fuel pickups have a chance of appearing in a straight line. Also, this condition has a 50% chance of running censored US zero Orban and works only if it on zero. Then the fuel. The stars is created at the position, and its depth is increased by 10. So with a higher depth, it will appear below other instances. Dissents along one again based on the Cosby Dennett copiously current explanation to the previous exploration were able. Now we're in the game. You can see the fuel pick ups being created when you just them. The fuel increases and the animation runs knowledge continue to the next lecture. 11. B9 - Game Menu: Hey there in this lecture, Wheeler, the game starts green here I've imported to strides. This is the games title and this is a play button. Make sure its origin is real tender. Now we'll go to objects and create all menu. Manager will also create openly and said thus pride. Now we'll go to rooms and I'll rename the room to RM game. I'll create a new room called RM menu and place it at the door. I started size to 7 20 but to a lady I'll also place Oh Manu manager here. Now we'll open a background layer and said the Lord's pride, a little trainable vertical child now will create an asset layer in this layer. You can place price directly. Soil place. Our titles right here now will open hopefully another create event here. Let this this told with a player has clicked on the play button. No wheeler. The step imminent. And at this year this will get whether the left most button is being cleared and this will get for that. A mouse is on the play button using position, meeting dysfunction checks, whether there's an object at a point and here the point is the most location Swifter player has click on the play button While I click, This fall's clicked will be set to True. If Clinton is true, the play button size will be reduced so it'll keep getting smaller. And when it becomes small enough, the room will change to RM game now an open oh menu manager I label oppose instant option here. This means that when the room s change, the subject will not be destroyed and will be there in the next room. Will use this feature to run some code from the next room starts. No one had the creative event and at this year, this is a position where the play button will be created And here it is created using Lear Sprite create. You can pay sous pride in their asset layer. So here we're placing the car. Sprite disposition should be the same as in the creative inch. Off all Manager, this is a speed of the car and this too should be the same as it'll manager. No wonder the supplement and are this year this worker the vibe position off the background , increase it by car speed and set it back again. No other. The room started Bend here. Let this dissident runs whenever a room starts. Since the subject is persistent, it'll be there when the next room starts. So, districts, whether the room started is our in game. If it ISS, it will set them back only as y position to the one from the previous room and destroy the menu manager. So this raid of backgrounds position will appear to be the same, but you move to the game room. Now we're in the game and you can see the start screen here. If I click on the play but earned the game's charts notice move onto the next lecture we will make. The game was green. 12. B10 - Game Over: Hey there in this lecture, Willard. The game over screen. First of all, I'll go to phones, are duplicated the phone and name it FT. Hood Big. I'll increase its size to Eddie, so it'll be a bigger fond now will open or manager and open the creative end at the tow pilot. This this very able would be set to true. When the player loses and the game is over, there will be a black background for the game over screen. So this Rabel shows all fall of that background. This is a position with a score will be drawn on the game over screen. Doughboy is negative because of scored needs to animate into the room from that all. Now we'll open no player and in alarm zero, I remove the court. And at this, this is alarmed that runs when the player crashes. So this looks that oh man, just game over to true and this will create a play, but so that a player could play again. Now open your manager and go to the Georgie Wire end at the enter. Let this discord will run when the game is over. First the black background will be drawn dispenser the offer to the back all four and this will start the color to black Dana rectangle would be drone that will fill the room. Dender Color and the Alpharma be set to their default values. The back all far started zero, so it needs to be increased. 400 fades in so while a vehicle for its mold and 0.9 it will be increased. Then the phone will be said to FT. Hurt big for the score. We won't that X to be drawn in the center with the default line meant stop left. So agenda horizontal line meant to center on the vertical linemen to middle so the alignment will become middle center. Then the text will be drawn in the same way. The score is drawn normally, and then the alignment will be said to top left. The school needs to animate into the room, so it's why would be moved to disposition using love. Then finally, this will draw the play button. We're doing this because the play button is an object, and so it's bloated Joy lair. We don't want it to disappear behind the back background, so we re droid here on the Joy Layer. Now we're in the game. If I lose after two seconds, the alarm runs and the game over screen shows up. I can click the play button to play again. So now let's move on to the next lecture. 13. B11 - Music & Sounds: Hey there. In this lecture, we'll add music and sound effects. The function for that is audio player sound. It has three arguments, the sound to play its priority and whether it should loop or repeat when it ends. The priority doesn't really have an effect, so we'll be setting it to one. So let's get to it here I'm imported. All the sounds we're gonna add. This is a car sound. This is a back our music. This is for the fuel, bigger boobs. And this is for the car collisions. I'll open the back our music and videos its volume to 0.5 because it's too loud compared to the other sounds. I'll open all Manu manager and open its creative end here. I like this. This will play the backer music. The priority is set to one, and looping is set to true, since we've owned the music to repeat now an open all manager and go to the creative end. At the end of that, this this replace the car sound with looping said. Too true, This does a pitch off the car sound, so it'll start low and will keep increasing here. The pitch is applied to the sound. No one opened us temperament and hard this year. If the carpet a small than two, it will be increased by a very small value. So it'll keep going up slowly until it's that, too. And here the pitch is applied to the car sound. This checks with a player has crashed, and whether the car sound it's still playing. In that case, the car sound will be stopped. Now we'll open your car and go to the separate meant. This is a court that runs when a car crashes sorted. Send. I let this dissolute later crashed. Sound looping is set to false because we want the sound to play only ones. And also make sure that the scored comes before the last bracket now will open or fuel and go to the separate meant. This is weird clients with the player, So here I'll play the fuel sound no around the game, and you can hear the music and the sounds. Now let's move on to the next lecture 14. C1 - Facebook App: Hey, there in this lecture will create an app on Facebook for our game. First, you need to open Facebook and signing from your account. Then you need to go to developer start facebook dot com. Here, you need to click on get started and then follow this form to sign up. As a developer here, you need to verify your phone number. After that is done, you need to enter the name for your first app or game for our game. I just write card game, then just under your email and click next. I don't think I'm a robot, so I just go ahead. Dennis, like whatever describes you best and click on a radio first Products. This should open a poor experience for your app. Sweat, scroll down and go to instant games. I'll click on set Up. This will make your app understand Game. Now let's move on to the next lecture waiver America Instant game work on Facebook 15. C1.5 - Small Changes: Hey there. In this lecture, we need to make some small changes to the project so that it works with Facebook's new Gen jails. First of all, we need to go to options than esteem if I And here we're sales STM a five game, which is a folder for the resources, we need to change this to a door. This will make it so that all the fires are placed in the root folder instead of being in a separate folder called as Table five Game. Then we can hit OK to save and close it. Now we'll go to my next stop and get a new tax file and genius name to FBI confit Gorgeous on. You can also find this file in the resources off this lecture, so I'll open it with note paired and are this year. No, don't worry about what this does is justify. Let's no required in every Facebook game, so save it with controllers and then close it now will open gamemaker alert leg only read files. It's like inserting word file Dennis like the fire that we just created, so it will be added in the project as an included file. So that's all for the genius. Now let's move on to the next lecture 16. C2 - Our Instant Game: Hey there in this lecture will make our game work on Facebook for this lecture will lead, not pair plus plus you condone ordered from this page links and the resources. First of all, you need to click here and select the STM, a five export to be able to compile for where now we click here to export it and select loose files. Then you need to select a folder where the fires will be saved. After it's done compiling, I'll go to Intuit files, right click and select insert included. File. I'll go to the folder where we compiled our game and select Index Torres TML. Now let me explain what we have done. Every game compiled for STM a five has an extra schema file. That file is used to start the game. If we want to edit that file to add defense book Esther as u K. We have to import it as an included file, edit it and then said it as a custom index file suit of the game uses it, so I'll go ahead and do that. I click on options and select a simple 54 Dynex file. A select are included file instead of 34th 1 and then hit. Okay, now right click on an Exodus TML and Select Open and Explorer. This will open the folder of it. This file is stored. Then I'll open the file with North Pair Plus plus. Now will open my browser and Google FB Eastern Games. I'll go to the laying that says Facebook. For developers, a click on getting started and scroll down to this part on cooperative Scored Good nor Bad Plus plus school down and paste the code under the body tag. This will Lord Defense Booker start as UK. Now we'll go to this part. It sets a gamemaker innit function to run random in the Lords with then starts a game. I remove this line and instead, under this year, this will create a custom function that will run went up in the Lord's first. It will call the initializing function from death being stern as decay, which will initialize Facebook Instant. It's gonna sink function, which is short for us in groaners. Such functions take time to finish but don't pose a cord. So whenever that function finishes, you can run some code by adding a function inside then. So after the function has finished the games, lording progress will be set 200. The game will be started and the game occur in its function would be called. Now we'll go to the top to the style court. Inside the canvas bloke allowed these three properties this. Make sure that the game skills properly in the Facebook and worse no, make sure you save the file by pressing control as now, we'll go to game maker. I click here to build a game and slept The ZIP option. I choose a folder and select sale. No will open the airborne Facebook. Understand games. I'll select Web hosting, hear a click on upload version. I'll click on browse and select that If I we just created and then magically gonna Plourde den. It'll scan and process the file. And when it's on stand by, you need to click here to push it to production. No need to go to settings and then basic school down and you see a laying. This is where you can play your game. No, our game is working on Facebook, so let's move on to the next lecture 17. C3 - High Score: Part 1: Hey there in this lecture of will implement and online high school system basically related functions inside a JavaScript extension for setting the high score and reading age for transferring the high score from the extension to gamemaker will be using callbacks scripts there. Basically scratch that. You can run from the extension and then you can pass data in diskettes arguments to make a call back script. You just have to put GM call back at the beginning of the escape name, so let's get to it. I'll create a text document on my desktop and name it. TXT Door Js Now open gamemaker. I'll go to scripts and create one Our labor Jim Callback underscore Get Score Dental Earlier this year. It'll simply apply the first argument to the global high school. Very able. Now we'll go to attentions and create one our limit. Txt under fires on right leg like that. Fine. And that's like the exit door justify that I just created on my deck store. That file will be added to the extension No. One right click on the extension and select open an Explorer. This will open the folder where the attention files are stored, so we'll go ahead and open the extra adored years in North Burtless. Plus here, let this This will create a function called set score, which will take one argument, which is a score to be said. It will run the centre dousing function for the player. It'll take an object with the score key. So dysfunction applause this object to the same system where this is a key name and this is the value. They don't have to be the same. They just happen to be so in our case. Then desecrate a function called Get Score, forgetting the school from Facebook and passing it to gamemaker through the callback script so it will use a getter. Nothing function to get a score key. When that function gets a data, it run dysfunction. Here I'm running are called X script in game maker India's. You need to redeem a script before the script name to run it here in passing the score from predatory. But you can also see to Noel arguments these are required for running Jamous scripts in Js . But the actual arguments start from here. No, make sure you save this by pressing control plus s now we'll go back to game maker and open our attention. October Click on the extra adored years to open its properties here we can list the functions in the extension so that game makers able to use them. So our click here and add a function. I'll set its name to set score and eternal name to set score as well, which is the actual name off the function Energy s file Den Aladdin argument here inside, it's type two double, which means that it's a number. So we'll need to pass one arguments to dysfunction, which will be the score. Dana Let the gets core function now open or player and go to the Lambs. Ugh event, which runs when the game is over. Here, let this this will run. This has core function from the extension and passed the future able as a score The function. Build an upload the score to the Facebook database. Now we'll go to phones and duplicate ft. Heard I lend us after hurt. Small asserted size to 40. Now we'll go toe menu manager and open the creative end here. Let this This will create the global high school very able at minus one and run the gets core function to retrieve the actual high score from Facebook. That function will get the high score from Facebook and run. The Colbert gets course scraped, which will then apply the high score to the global high school. Very labor. No wonder that Giorgio I went in there this year. If the high score is at or above zero, the phones will be said to FT. Hurt Small, and the high score text will be drawn. No well compiled the game as a zip. Then I'll opened of a boasting section on Facebook and applauded as a new version, Donald Gateway, to scan and then publish it. Now we'll go to settings than basic school down and open this link to test the game. Bookmark you link so that it's easier to access. I'll play the game ones, too, for the high score, a real occupational. And when the game starts, the high school shows up here, you can see that the high score is being drawn in a black color. That's because of the false color in a C. Amel five is black. So to fix this at the start of the game. I'll said the color to white In the beginning of this lecture, I created the exchange and file on my deck store. I deleted. Since the file is copied into the project and the original one is nor used no, let's move on to the next lecture. 18. C3.5 - High Score: Part 2: Hey, there in this lecture will finish our high school implementation. I'll go to attentions, right leg only, X T and select. Open an explorer. I'll open the next door gears and go to the set score function. Here. You can see that doesn't score function. Searched that data as soon as the function runs. But that's not what we actually want. So I remove this cold and in its place under this, and just like the guts core function, this will first use gathered Ussing to get a player score. The score will be loaded in the battery in the callback function, and then we have to conditions in the callback function. If the score entry doesn't exist or the new score is greater than the loaded score, the score will be said. If the new score is not greater than the Lord score, then it's not a high score, and will lord be saved, so this will make sure that only actual high scores are saved. No, make sure you save the file so that sold for this lecture. Now let's move on to the next one 19. C4 - Sharing: Hey there in this lecture will implement a share, but for sharing your score will get a function energias extension called F B share. That function will take two arguments. Score an image. The score will be defeat. Value. An image will be an image that will be shared with the score. That image will be in basically four form, which is a string instead of an image file. So before adding enemies to the sheer future, you'll have to convert it into a base 64 string. So let's do that. I'll open Bay 64 Image Store, D E. LinkedIn The resources here. You can upload any image, and it will be converted into a base 64 string. So I'll drag and drop my image here. Denel Click on Show Gored, Dana. Click here to corporate. I'm a string. Now we'll open game maker and go toe Oh, Manu manager Inside the creative, and I'll create a very able called global basis for image. I'll place courts here and paste a basically fostering inside accords. Sotus were able restored the image for the share function. Now we'll go to extensions, opening extra in exploder on open the extra adored years here like this. This is our sharing function. Disregard the players full name, and this will run the split function on the name. The split function basically exploits the words inside a string and post them in an array so I can get the first name of the player. Beginning the first item in the array den, it will run the sheer issing function, which opens a shared I law. The intent tells that we are sharing something. This is the image to share, and this is the text that will be shared sort of go name race for this much feet. Can you bid this? No. Make sure you save the file. Now. We'll go back to game maker and opening X'd. I'll open the exit door, Jesse's properties and here at the beach here function Isler. Two arguments here. The 1st 1 will be a double for the score, and the 2nd 1 will be a string for the image. No Wheeler, the share button here I've imported us right for it and set its origin to middle center Now will create an object for it. An image or here. I'll said this bright DiNardo step prevent honor This year, using Herb, this is Moodley moved that scared was one. Then the Y scale will be said to the EC scale. This will check whether the share button is cleared and if it is, the scale for the bottom will be set to 0.8. This will run the official function with a florid feet value as a score and the basic before image now will open no player and open its alarms. Your event here like this this will create a share. But at the centre, boredom off the room. Now open your manager and open its Giorgio event as cool down and below the court. That Rosa play button I let this So this will draw this year, but an energy while air. Now we'll build a sip of the game and applauded on his work. But after two messenger and after the game is over, you can see the share. But in here it opens a shared I log and if I share it with someone, it looks like this. So they're sold for this lecture. Let's move onto the next one 20. C5 - Updates: Haider in this lecture of will implement high school updates in our game. Updates are messages sending to a chat automatically after something specific happens. So in this lecture will implement updates for high scores whenever a player scores a high score and updated sent into the chat about it. So let's get to it. I'll open the extension folder to other txt door. Yes, another new function go left. The update dysfunction is very similar to F b. Share it eggs, the same arguments, the score and the image. Then it gets a player's name, spirits it into a Neri and gets the first name. Then the update. A sink function is run for posting an update in the jet. Now let me explain that. So if you need to know about this is a tax Turcios up on the play button in the update. This is the image. Soy takes it from the argument and this is a text. Now we'll go back to game maker and opened the extension. I learned the FBI update function with two arguments audible and a string just like a fish here. Now Logano player and go to real arms. The event here like this. This will run the guts core function, which will get the high score and then run the GM called Burger, Score, Script, Soil Open that script and there this year when the high score is loaded, this will check whether the room is the game room, that the game is over and that the current score is at or above the high score so that we will know what the top layer has called a high score or not. If the player has called a high score, the F B of their function will be run with a florid feet value, and the base 64 image now will build a tape of the game and then uploaded on Facebook. I'll tested in Messenger. I've scored a high score here, so I closed the game and you can see the update in the chat. You can also click here to play the game so the updates are done. No, let's move on to the next lecture waving set up ads 21. C6 - Ads: Part 1: Haider in this lecture will set up ads for AB. First of all, you need to open business dot facebook dot com and create an account here. After creating your business a code you need to go back to your page here, click on the plus sign next products to another products to our lab and then reflect audience network. This is what enables airs in your game. He really just liked your business account to proceed. Nobody to create a property for our game. So a limit card game Donald Clear couldn't go to more division manager. No, A property has been created. A click here to create an ad space and call it my ad space. Here, you need to write with the Advil Appear in your game. Swell titled Appears on pressing replay button on a game over screen. Definitely cute to create it. Nobody to create an ad placement swallow. Click here. I'll name this interstitial. Basically, there are two types of bears. Interstate heels and rewarded videos. Industry shows are really short ads, and in most cases they're just images rewarded videos. On the other hand, I videos that a player can forge to get a reward like another life or some coins sore. First ad will be in interstitial. I scroll down and click here to create a place man. Now we'll click on card game here to go back to that property and click here to have payment and four to my account. After you're better, the payment in four you literally consent for review here and some of the game for at review. After the APP is reviewed and accepted, you'll be able to add ads in your game. So if you can't see this page, then you need to go to your property and click honest on games and to open your property at any time. You can click on all your set work on your page and then click here. We'll wait for the review before implementing airs in our game. So until then, let's move on to the next lecture. 22. C7 - Invites: Hey there in this lecture with Garden in white Future in our game for that will use the function. Choose a saying, which allows you to change the context off the game. Basically, the context is that that video game is being played. So let's say you're playing the game in person. A shared, if you could. I invite button and selected person be that personal stat will open and the game will start there. So this way the context can be changed. Turning my button. So that's got do it here. I've added this pride 14 White button and such. It's origin to middle Center. Now we'll go to scripts and create one. I limit GM. Call back on the score game start So the school back script will be used to restart the game when the contacts exchange. So inside it allowed dysfunction to Easter. The room. Now we'll go to extensions and open txt. An exploder I love when you next see George years. Under the end of that, this dysfunction is called FB Jews, and we're under choosing function for the grand context. This will open the in might window where the player can choose a friend to play with. It went the players lecture person to play with that, Then function be run, which will done run the cold back script. The script will then restart the room and the game will start. No, make sure you save this and I will go to game maker and open the extension that allowed the function at vigils here. No, we need to make the invite button so I'll go to objects and duplicate or play a limit or in white and sad. Dynamite's right. I'll open the step event and go to this part here are removed the court inside the clip condition and replace it with this. So when the button is clicked, it were under FP. Choose function and said Clegg to falls now will open or player and go to the alarms. The event at the end of that This this will create the invite, but turn to the right off and below the play button. Now open. Your manager opened that Giorgio I rent and school down after the court that draws the share button. I let go to Georgia invite button as well. Now we'll make a zip and upload it I run the game in messenger and you can see the in my button on the game over screen. If I click on there, Dean, White Winter pops up. If I close it, nothing happens. If I open it and let someone to play with. It starts a new game with that person and opens their chat as well. So that is all for this lecture in the next one will implement ads in our game. 23. C8 - Ads: Part 2: Hey there in this lecture of a little much aired in our game in a previous lecture, we submitted our game for review for the ads, so make sure that the game has been reviewed by going to add property and clicking year. If it got accepted, you'll see a tick here being very far does not acquired for this lecture, but without being verified at the not appear in your game at all, so you won't be able to test it. So let's get to it. I'll open the air page and go to Audience Network. I click here to go to our property. I click on the air space than the institutional placement and click here to cooperatives placements I d. So I can you decide e to request ads. Now we'll go to game maker and open the attention. At the end of that. This this very able was told the place morality for the interstitial soil PST. I t here and this variable withdraw the i d off the actual ad after it is loaded. So for now, it's hard to know the at your function will load the interstitial. So first it will run the gut institution advising Function with the Interstitial Lady, which creates an earlier stance after being stars is created, it's loaded into this variable and then apply it to the loaded at variable. Then the loader thing function is run on the registers, which Lords the ad return is used to end a function. So here it's used to make sure that the callback function, and here then the at play function will simply check whether the loaded at very able hold something. And it's not know and in that case shows the ad. So one function lords the ad beforehand, and one players it when required. No, not save it and go back to gamemaker. I look on the extension, and they're the functions at reload and at play. Now local, no manager and open the creative nge. I'll run the at your function here, Sedated Lords and at when the game starts now will open no plea and open the step event. I'll go to the part. We have the room exchange after clicking the button. So before the room go to function allowed this swift, a button is used in the game room and not in the main menu. The ad will play. Now We'll build a zip and applauded as only work on mobile. So now let's switch over to my phone on the game over screen. If I click the play but turned to start another game, the Arab years, so be a good interstitial is to work in our game. Now let's move on to the next lecture. 24. C9 - Leaderboard Data: Hey there in this lecture, you start working on implementing a little in our game. So here's a little work. Force will create a leaderboard for our game on Facebook. Whenever a player finishes the game, the score will be said toe the leaderboard so that leaderboard will contain scores for all the players. Then we lowered all those entries in our game and create a Mandiri that we hold in four for each player in the leader board that Minnery will have an array for each entry that will hold that player score, name and picture, then will pass older in four to gamemaker and display it so not get do it. First I'll open the air page and then click here to open the leaderboards page. We need to create a new leader, bold soil under its name. Here I was scolded Leaderboard, Then make sure that this option is said to know so Data Leaderboard is global. Also, make sure that this is set to higher is better so that the people would hire schools for entire, then click on Save genius and a leader board will be created. Now we'll open game maker and opened the extension file at the top. Al Qaeda Very able that stores the name of the leader board that we're going to use. So in case you ever want to change the leaderboard, you can just do it here. Now a scroll to the bottom And are this year disfunction. We load the leaderboard force, it will run that Get leaderboard acing function which will Lord the leaderboard data. When the leaderboard is loaded, it will run the gut entries using function which lords? Eligible entries distance How many entries you want to, Lord? So here you're loading 100 entries and this tells which place you want to lord the entries from So this will just Lord 102 years from the first place. When that function is done, the entries will be ordered in this array so he will create the Minnery to store old line. For then, this four loop will go through each entry inside the entries very burning from zero to deary's land. So this will get the entry for each loop by using. I own the entries, Ray, This will get the players i d for that entry. Then this will create a new way to store that players in four. So in the first place, it'll keep up Leah score in the second place. It'll keep the player's name, and in that hurt place will get a link to the Prius. Photo done. Battery will be added to the Minnery at I so all of this will run for each entry in the leader board after they're dead. Jim Colbert Palatable script will be run, which will be created in the next lecture, and the Minnery will be passed to gamemaker to descript now a scroll to the top and go to the set score function. Currently, we're saving a player score in Dublin's data. No to the leaderboard. So inside the function other days, this will run the gut leaderboard losing function to load the leaderboard. Once the leaderboard is loaded, I'll run this. That's coursing function to set the score to the leaderboard. I run the math around function on the score value to round it because its function nears on a teacher. You can also save some extra data in the string, but we don't have anything to save their, so I leave it empty. Then, after the score is said I run the FB leaderboard function, which we load the leaderboard data and pass it to gamemaker. No, we need to receive the data in game maker on display. The leaderboard will do that in the next lecture. 25. C10 - Leaderboard UI: Hey, dear In this lecture will continue working on the Leader board will create the callback script that we called in the attention GM callback leaderboard. It will run from the leaderboard. Entries are loaded from Facebook, so it'll create a button for the leaderboard and the leaderboard itself, which will be hidden at first. When we press that button, the leaderboard will show up with all the entries. So let's get to it. I reported a few sprites here. This is a little button and its origin. Israel Center. This is a box pride for the leaderboards books and its ordinance Top left, and this is a close will turn for the leaderboard and its ordinance. Stop right and also make sure that you have the drawer nine slash scraped from the previous lecture. Now we'll go to phones and create one I limit Ft. Hood. Had I thought it sides to 30 and the style too bold, I'll create another phone called ft Heart text. I thought it size 2 24 Both of these force will be used for the leaderboard. Now we'll go to objects and create an object called or leaderboard. So this will be the leader board. Little show all the entries If we need to make the butter now swell, duplicate or share a name, it already are. I said. That's right. No. And now I'll open a step event. I'll go to this part where the F B share function is run and remove that line in its place . Allowed this. So when the button is clicked, the leaderboard show very able. We said too true so that it shows up. Now we'll go to a manager and open that Giorgio event A scroll down and add is here to draw the leaderboard button. Now we'll go to scripts and create GM. Call back on the score. Leaderboard inside it. Under this, this will create an Inam with three members Score, name and photo. Basically this zero This is one and this is to decile. They are just a group of numbers in ascending order. So see, I have to take the name from an entries are a We know that the name is in the second place , which is one. So I can do this, but no. With this scene, um, I can do it like this. It's the same thing But the difference is that now I don't have to use the number as that can get confusing. I could just use the Denham, and it makes much more sense from the extension. The Minnery is part as an argument to the script. So data is loaded into this very able than this clears a little button disk rears a leaderboard object and this positive very to the leaderboard object in this variable. Now we need to lord the images from the legs so that the becomes rights. So this loop will go through the machinery and Lord the array for each entry. Denver you're on the Sprite ad function on the photo laying and showed the result in the same place in the air A. This will not lord the image internally, as this is anything function so far, it's callback. Will need to use a nothing Cronus event. Also, you can see that I'm using the at symbol here. There's a school and access for and has to be used to whenever you're changing the value. Often, Ray, which is stored inside another a ordered a structure. Now we'll go to a leaderboard. I learned the creative and and are this year Destro's whether the leaderboard is shown or not. This is a margin for the leaderboard inside the game indoor, and this sets the exposition off the leaderboard, toe the margin and the y Tu minus room hide. So it'll be high above the room and what re visible. This was heard of it and hide off the leaderboard, which is the size off the room with the two margins removed. Here's what the leader board will look like now. This is the height of each entry in the leader board, and this is the height of the photos, and this is the height of the header or the title. These very Abel's just rolled the most location for the previous Sepp and could be used in the next sector. Dextrose homered. The entries have been strolled and their Stroh's with it. A player has clicked. No, I learned the separate meant and here like this, this very able restore. What did the left most button is being pressed now. If the leaderboard is being shown, the Y value will be moved to the margin value, using love for to show up in the room. But if it's not being shown. It will be moved to minus room, hide, footless appear again, and when the leaderboard has shown, all the bottoms will be deactivated so you won't be able to press them. And minutes north, Sean will be activated again than this cuts. Whether the mouse is inside a top right area off the leaderboard with a close. What only supposed to be. It uses the point in a tangle function, which it does, whether a point is inside a rectangle. So here are point is the most closer and the rectangle is the close area. If the most button is clicked inside the close area, the show variable will be said to falls and the leaderboard We close No at last. The previous most portion variables will be updated. Now we'll go to the A synchronous events and are damaged ordered event Desam. It is the cold bag that runs after an image is loaded. So here, let this Let me just resize the window. This loop goes through all the entries in the main re and this gets an entries or a. Since this is a callback event, it loads some data in the A sink low DS map. Now, you don't have to know what RDS map is. To use this, you can just load that Adolf Rome eight by using the question market researcher. So here I am, loading the I d off the pride that was loaded and it stayed us. If the traitors is at or above zero, which means that a sprite was loaded and that does. Pride is the country is photo. The following court runs here. I'm getting the very it and hide off the sprite that was loaded. Now the image that is loaded square. But we want to make it look circular. So we'll do that. Using us her face, we will draw a circle and then using a blend mode print temperature over it. Then we'll convert that surface into us pride and use it in the leader board. Here. I'm creating a surface with the size of this right. If you don't know where the surface is, it's basically an empty space where you can draw something and later Georgia surface to the screen. So I said that target to that surface so that I could draw on it. This will clear the surface and make it empty. This will draw a circle at the central of the surface, having a radius off Harvard size the sets of then mood, so that what Vidro is multiplied with the circles, all for another. Circle itself doesn't appear. If you don't know what blend modes are, open the resources and work the link YouTube video. Then it draws a loaded sprite on the surface, and you said the bend more to normal. So by this point, the surface has a circular image inside it. So here I'm resetting the surface target Sophia, no longer drawing to the surface. Then this creates a sprite from that surface. This is a surface. This is the top left corner off the surface. This is the bottom right corner of the surface, and this is the origin for the origin is at middle center. Then that's pride is stored in the area in the same location. Then the surfaces freed, which means that it is lead ID and the squares. Pride is loaded as well. No, we need to draw the little bold Soledad Rodeo event allowed this year. This uses a drawer nine slash script to draw the leaderboard Sporks at X and why the size All that books is a bit and height of the leader board, despite draws a little ball text so it sets the color to black the force to Ft. Hood Head, then Sensi horizontal alignment to center and the vertical alignment to middle and then draws the leaderboard text. And then it resets the horizontal alignment to left but keeps the vertical alignment at middle for the court below than their senses afford to Ft. Hurt Decks, then runs a loop that goes through all the entries, and here it lords and entries are a This says the pollution, where that entry will be drawn on the leaderboard. So the X is a leaderboard, eggs and the why is had hide attitude abi and then entry hide multiplied by I. So, as you can see here, the wife for the 1st 3 entries would be like this. This gets a sprite from the array. This make sure that it's not a string which would be a link instead of despite itself and this text whether the sprite has been loaded. If these are true, the sprite is drawn. DesCartes, the scale at which it is drawn by dividing the photo height by the actual strides hide. And then it's drone was only 64 pictures to the right, off X and vertically in the middle of the entry. Then the scale is applied to the Sprite, using draw spry txt. Then dysfunction draws the name of the player 1 28 pictures to the ride. Then there says he wasn't alignment right, because a score needs to be drawn at the right side. So I drove the score by subtracting 30 from X plus. Wait, Dan. It resets the horizontal linemen to left. So this loop runs for all eligible entries and draws them one by one. After the loop is over. It exactly vertical alignment to talk and the color to white. Then they draws a close with and Sprite at the top right corner off the leaderboard. Now we'll build a zip and upload it to Facebook. I run the game and make a new high score so that the new score is saved to the leaderboard . Then the leaderboard button should appear, and if you click on it, your seals have there. Now let's move on to the next lecture, reveal their scrolling 26. C11 - Leaderboard Scrolling: Hey there in this lecture will implement scrolling in our leader board. First of all, I'll open the extension and go to the AFP illegible function. I'll go to the four loop that gets all the entries and chain entries don't lend to 50 and here instead of I allowed zero and now we'll hit control F to save it So the for loop will run 50 times. But in all those loops it will only read the first entry. So basically the first entry will appear 50 times. I'm doing this just to test the schooling system so make sure you under the exchanges at the end now all open game maker and go toe on leaderboard. I'll open the creative ends and our this year this very able we store the surface. We will draw the entries for scrolling So far No, it's at minus one. No wonder the drawer begin event and there this year If the surface doesn't exist, it will be created with Britain. Hide all the leader ball except the head hide. And now we're the cleanup event. Not this year, dissenters when a listers is destroyed. So if the surface exists, it will be needed now will open the step event and after the show, good. I let this this will get the difference between the crunch will fly and the previous most. Why so girls? The vertical speed of the mouse. Now, if the most is clicked and the speed is No. Zero, which means that the most was moved vertically, that speed will be added to the scroll. Very able. Now this is the next mum's role value. It's simply the entries. Height multiplied by the number of entries in the main Mary and the leaderboards hide removed from it. So basically it's the height of the entries that are not visible. So using clap the school why value is limited to a minimum off, negative next role and a maximum of zero. No, I'll open that Giorgio I rent before the four loop starts allowed. This this will set the target to the surface and then clear it. So now all the entries will be drawn on the surface. This way, if you scroll them, they will not appear outside of the balls. No, I'll go to this part inside the loop and remove X from here and replace it with zero dental Remove y plus had edge from here. I'm doing this because we are drawing on the surface now and no directly on the dual air. So the values that removed from here will be added to the final position off the surface. And now we're there. The school value here now, after the loop is over, I'll at this. This would research the surface target, and this will draw the surface. These are just the corners that we removed from inside the loop. Now we'll build a zip and upload the game. Alexis the leaderboard and you can see a list of duplicate entries I'm able to scroll using my mouse. Now we'll go back to the attention on, do much in years and saved a fire. And now let's move on to the next lecture. 27. C12 - Leaderboard Bug: Hey, there in this lecture will be fixing a small book with the leaderboard. If you end the game and quickly hit play before the leaderboard Lords, you'll see that it lords inside the game. So let's fix that sort of fix it. I'll open GM called back Leaderboard and at the top allowed this swift a game over. Able is false, which means that the game is running the script. Wilder Nothing. And that's because when you use return in a script in game Maker attends a script and returns the value next to it the district earned. We have no value because we don't want to return anything. We just want to under script. Swift. The game is running, the script ends and the leaderboard is not created, so that so. Now let's move on to the next lecture. 28. C13 - Ad Update: header in this lecture Wheelabrator code for the ads, previously as only used to work on mobile devices. But now the work on browsers as well, and on browsers, they don't pose the game as the two on Mobile Someone the actu up. You can see that the game keeps running in the back, so let's fix that. First of all, I'll open the Opilio object and then open it. Step event. I'll go to the line that runs the aptly function and place the air and remove it. Then I'll go to this part here. You can see that the clicked very Able is had to. True if the play button is pressed. So I remove this line and in its place under this, if the current room is a game room, the admirably. But if it's not the game room, which means that it's a many room, the clicked very able, he said, too true. So while in the many room the bottom will work inside the game, only the ad will be played. Now I'll go to scripts and create one. I'll name a GM call back on the score at done. This will run when the air disclosed so inside. It allowed this. So when the undisclosed hopeless create very able will be set to true and the game will continue now will open the attention a scroll down and go to the ad play function. The shore sink function is a nothing Cronus function, Soviet that then function to it. So I removed a semi colon here, and after that, I had this. Dysfunction will run when the shore sink function finishes and it will run the GM callback Adan script. So when the alley is finished or it's close, the play button will be cleared. Here. We also have a catch function, which is very similar to then there's a function, and it turns the GM callback Adan script. The difference is that that then functioned runs when the icing function finishes successfully. But if there's an error and Ussing function can't finish the catch, function runs. So what are the air chose? Or fairs? We've owned the scripts to run so that the game continues. No, make sure you save the file now will upload the zip to Facebook and played if I click on the play. But you know you can see that the actuals up, but the game is posed and does not run. When I closed the at, the game continues. Now let's move on to the next lecture. 29. C15 - Publishing: header in dis lecture. I'll tell you how you can publish your game. Basically, you need to fail all the details that are required and then submit the game for review. Supposed to fool, you knew to open settings and then basic, and then feel older details that are listed here here. You also need to enter a link to your privacy policy. If you don't have one, you can go to free privacy policy dot com and create one for free. Then you need to go to instant games and then details and fail all the details here. You also need the images and the videos. Then you can go to review as off. Now you need to enter your Apple Developer Team I d to submit your game for review. Then you can clear cornetto submission next to instant game and then submit for review. If there are any details that you have to enter before submitting it, you can see them here. Now let's move on to the next lecture