42 videos
238 minutes
Okay, we will advance the camera next to the character. To do this, what I do is move the camera continuously using the same speed the player has. To do this, all you have to do is, just as I got constant IMPULSE_JUMP, I'll take the PLAYER_SPEED variable, and I will move Constants. And now, what I have to do is move the camera while the player is alive. To do this, we can do
moving in the render () method. All you have to consider is you have to move the camera frame by frame. We must calculate whether the player Progress has been made at this speed per second, we have to see how much to move in tenths of seconds that have passed since the previous frame. It is an equation like this. The displacement is, the constant speed (in meters) by the time that has elapsed, which are milliseconds,
so that we can determine how much progress has been made in those milliseconds; multiplied pixel using the conversion factor, because the camera They also work in pixels. If I put this to the camera, making a stage.getCamera () to get the camera Stage, we normally but we do not see, and we do a translate the X component, the other may be worth 0, then the camera now will always move. All that remains is
put a period to the camera at first locks. We will, for example, that camera shake if the player has advanced 100 pixels. If the player is still alive, too. Because if the player dies we want the camera stops. Now, we can track the player. Let's see. All right. You see the camera moves with it. I expected there were more things here. I'll put them. Meter things will be complicated. Because as we shall see
in the following video, this must be synchronized with music. And this requires skill and imagination. And here are things that we have in this series, so I'll add a couple of spikes in positions I think they go to the rhythm of the music, then I will add music, and surely then adapt it. But in a professional game this should take much longer, especially if you pretend to sell in the Play Store. You do not want that your
players are sad. Moreover this is an example, is not making a serious level. We'll try to create a couple of things. All I know is that the music will use, is the beginning and rhythms that make it sound like a drum ...? Does every 4 seconds? So I'll add skewers with a separation between them of approximately 4 seconds. This I will do to eye because I can not measure well, but I'll put one in the 18th.
It will be in the air because there is a step there and I have to give up 2. Another 32 ... this will not go well. Another 50 ... and see what I've created. Hopefully you can jump over spikes at the beginning. Voucher. Obviously, I'm too bad for my own game. And I showed in the demo I'm bad with these games. You've seen what pro leap. Okay, there I lose, but as it is the last I'm not worried. We will also add more soil.
One in 30, which goes to 40. This I will have to get up ... No, actually I'm going to move to 35 because otherwise I will not be able to jump well. It is compose a level. Obviously, if a serious level ... ouch. I can not talk and play at the same time. I mean, if I had to do a lot more lines or a longer level would have to find a better way to keep the positions, as an Array. Let's see if I can ... oh. No no I dont know. I suck playing.
I want to see the other step! Nothing is seen that something you want to show you. Voucher. Here the second. All right. I will add music, to make this stay synchronized in some way.
About the Author
Biography: Analyst-Programmer in different languages. Tutor PREMIUM platforms recognized worldwide as CodigoFacilito. Editor Cristalab articles. My YouTube Channel is sponsored by the ANAYA and LaTostadora publisher. I like to explain in detail and give several examples for the avoidance of doubt.