![]() ![]() So, when you run a game in GameMaker Studio 2, you will have at least one camera, and it will draw what it sees (the view) to a view port, which is then shown in the game window to the player. You have a scene that you want to film (the GameMaker Studio 2 room where your game happens), you have a camera to film it with (the GameMaker Studio 2 camera obviously), you have a lens that captures what you see (the GameMaker Studio 2 view) and you have a screen that displays what you see (the GameMaker Studio 2 view port). The most obvious analogy to understand what is going on is to use that of an actual video camera. The View Port: The area of the physical screen where the camera view will be displayed.The View: This is what the camera sees, based on the position, projection and rotation of the camera.The Camera: This is essentially a "container" that will be used to hold the different view values and set how the room is displayed on screen.When you create your game, what the player "sees" at any given moment is governed by three different - but connected - things: This can all be easily achieved in GameMaker Studio 2 using cameras and view ports, and in this tutorial we'll take you through all the basics of setting up and manipulating custom cameras in your own projects. with the main character) while another part is fixed (for example some status panel). A further example is in games in which part of the room should scroll (e.g. Cameras can also be used in multi-player co-op games, as they permit you to create a split-screen setup in which in one part of the screen you see one player and in another part you see the other player. For example, in most platform games, the camera follows the main character, since if you could see the whole level on the screen then your character would be too small to see and there would be no surprises for the player. ![]() ![]() With the Camera object selected, Add Event > Step > Step.Cameras give a mechanism for drawing different parts of your room to different places on the screen, or for drawing just a single part of your room to cover the whole screen.Now we’ll add movement basic code to the Step Event. Finally, MoveSpeed determines how quickly the Camera moves to the Target position. Then we have the State variable which will be used to control the camera's behavior. These variables will be used to direct the movement of the camera and tell it where to go. Finally, setting view_visible to true makes this view active within the game.Īfter setting those values, we place the camera at the same position as the Player, and create the TargetX and TargetY variables. If you want the camera/player to stay in the center of the screen, the Vborder should be half the game screen’s height, and the Hborder should be half the width. Then it sets the Vborder and Hborder values, which determine how close the camera object can get to the edge of the view before the view starts scrolling with the level. First it tells the view to follow the camera object. Add the Action Control > Code > Execute Code.Īll this code does is set up the camera object for us.Right-click the Objects folder and choose Create Object.Sprite NameĮven though the camera will be invisible, the view will have issues following it if it doesn't have a sprite associated with it, so that's why we imported this image. It is located in the Assets folder you downloaded for the Tutorial under Images > SPR_Camera.png. Instead, we’re going to make a camera object that the view will follow, and program the special behaviors directly into it.įirst let's import the Camera sprite. If the camera’s attached directly to the player, this can be very challenging to implement. Normally we could tell our view to follow the Player and leave it at that, but eventually our camera will need special behaviors like a shake effect after big attacks. Game Maker uses Views to control how the camera behaves. ![]() Just like in the last article, make sure that you download the Asset pack for this article before you get started. This article will focus on creating a dynamic camera, making BattleRegions or areas for combat to take place, and giving the enemies the ability to start fighting back. It was a good start, but we still have a few more things to do before this starts to feel like a real game. In the last article we discussed how to make the player move and integrated some basic combat mechanics. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |