top of page
Writer's pictureintorsurdtivime

Game Maker Follow Screen: Tips and Tricks for Dynamic Scrolling



As far as I'm aware you just make an invisible object on your screen and assign this as a step event to it? I've also heard to make the camera follow an invisible object moving on the screen but this seems better surely?


The easiest way to do this is to make an object that's invisible but still has a sprite, and just give it an hspeed of 1, then have the view follow it. Create it a bit before the horizontal follow border so that the player can get their bearings before the screen starts moving.




Game Maker Follow Screen




I have drawn everything needed to the screen including a HUD for the score, but I have my room set to follow my player: When the camera follows the player, the score HUD stays doesn't scroll with him!


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. 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. 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. A further example is in games in which part of the room should scroll (e.g. with the main character) while another part is fixed (for example some status panel). 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.


The most obvious analogy to understand what is going on is to use that of an actual video camera. 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).


Now that we have an idea of what it means when we talk about cameras, views and view ports, it's time to actually use them. In the demo project that comes with this tutorial we have a very basic platform game that, when you run it, will create a game window that occupies the whole screen and shows the entire game room. If you haven't tested it yet, press Play in the GameMaker Studio 2 IDE and see it for yourself before continuing (you can move the player object using the Arrow Keys and make it jump using the Spacebar.


The first thing to do is select an object to follow. This is done by clicking on the button which currently says "No Object". This will open up the Asset Explorer where you can select one of the available game Objects, in this case the object "oPlayer". This is telling GameMaker Studio 2 that the view should follow an instance of this object if it is found in the room.


This border is the distance from the edges of the screen that the instance needs to be before the camera will update its position to follow the instance. In this case, it's set to 32px, which means that the view will only move if the instance is 32px or less from the edge. We need to change these values to 400px for the horizontal border and 250px for the vertical border. These values leave a little bit of "space" for the player to move in before the view starts to move, but give a large enough view around the player to be helpful.


The window is now the correct size but... it's is still not right. What have we done wrong? Again, this is an issue with the automatic things that GameMaker Studio 2 does when initialising a room. Not only does it set the window size based on the view port, it also sets the size of the Application Surface. This surface is what everything you draw in the Draw Event is sent to before being displayed on the screen, so by default it will be created at the size of the room if no view port is defined in the Room Editor (and it will be created the size of the view port if one is defined). We need to resize this just the same as we did the game window with the following code:


The camera view now still follows the player around the room, but it does so in a more "organic" way, easing into different positions depending on the direction keys that the user has pressed. This is a great way to let the player see a bit more of the room and so avoid traps or enemies etc... However, the current setup has a problem, which is that the camera can leave the room bounds. This is fine for some games, but for this one it's not very good, as you can see the "edge" of the room which breaks immersion. This needs to be dealt with but we'll do it as we add the next feature... zoom.


The window is where GameMaker displays your game, and, depending on the target device, there are different things that can be done with it, like set it to fullscreen or not, for example. Cameras (and view ports), however, govern what you see within that window, and so have another series of functions dedicated to them. The following two sections deal with these two aspects of displaying your game:


However, sometimes it's not enough to get information about the game window and views only, and you really need to know things about the display itself (essentially the screen that the game window is being displayed on). The following function all give you details about the size and orientation of the display, details about the GUI layer, and information on the mouse:


Thx for posting this i love all the comments and thank you for pointing out all the problems! i have been using game maker for over 5 years and having people ask me for help get annoying after a while.


Actually, I think one of the most amateurish things I see in Game Maker games is the use of overly saturated and/or clashing color schemes. Effective use of colors is a great way to demonstrate that you understand good game design. Cramming as many of the brightest colors you can onto the screen all at once is not.


I like this, nice short, and has some good points.I am interested though, was it sudo names that you had a problem with. IE Kengine Gaming? Or Branding things as fake companies? (With the LLC and the TM and so on?)Because I understand using a name and then sticking with it so that it allows people to follow a particular game maker.-Elmernite


Developers should use care when providing such screen reader-only text. The following techniques will hide content from screen readers altogether and should be avoided when providing screen reader-only content:


The tool that actually constructs the various scenes within the game is called "Scenes". Each individual scene is created here, including the fields where the player character moves around as well as title screens, various menus, and so on.Most scenes can be created by placing tiles to create a field, then placing objects on it. You can also set up camera positions and movements, and incorporate elements such as behaviors that use physics calculations.


The menu scenes in the Scene List are special scenes, primarily used for setting in-game displays (UI). Menu scene UIs can be displayed during a scene by designating a scene as a "default display menu screen" or similar in the scene settings window when creating another scene. Menu scenes cannot be deleted, and their names cannot be changed.


Enter a numeric value to specify the follow threshold for the camera.Follow OffsetEnter a numeric value for each axis to specify the distance between the camera and its target object, which should be kept during the game.Field of ViewSpecify the extent of the observable game world that the player can see on the screen during the game. The higher the number, the farther away is the camera, and the larger is its field of view.


For example, I always use the init-update-draw idiom for each interesting object (i.e. init_monster, update_monster, draw_monster). Recognise the patterns in your own games, document them, and follow these as standards.


When you use a Visual Studio template to create your app, a default image is added to your project and set as the splash screen image. The background color for your splash screen defaults to a light gray. If you want to change the default image or color of your app's splash screen, follow these steps:


Now we are almost ready to run the game and see our sprite being drawn on screen. Create a room, name it whatever you want, and place your oPlayer object in the room. When you run the game you should see the sprPlayer_Idle sprite being drawn. However that sprite isn't animated, and it doesn't move. It's just sitting there being boring. Let's fix that.


Run your game, and if everything was done correctly, you should be able to flip the direction your newly animated sprite is now facing by pushing the left and right arrow keys. This is because in the Draw event, we are multiplying xScale by facing. The best part about this is that your sprite mask is not changing when your sprite is flipped. Now, do you remember the Approach script we added? Using that to make your sprites squash and stretch is a great way to add some life to your animations. Add the following lines below what we just added:


The things that a user sees when looking at a Ren'Py game can bedivided into images and user interface. Images are displayed tothe user using the scene, show, and hide statements, and are generallypart of the story being told. Everything else the user sees is part ofthe user interface, which is customized using screens.


Screens have two main functions. The first is to display informationto the user. Information can be displayed using text, bars, andimages. Some of the information displayed in this manner is vital togameplay. The say screen, for example, is used to display dialogueto the user, including the character's name and what she is saying. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Comments


bottom of page