GameMaker Studio 2: Camera Follow Player/Object

Поділитися
Вставка
  • Опубліковано 26 вер 2018
  • This is a quick video on how to make viewports follow an object. The actual coding required is 3 lines.... so I spend a while explaining things!
    If you want too know how to ALSO clamp the camera based on room size, check out this video: • GameMaker Studio 2: Ca...
    [--- SUPPORT ME / SOCIAL MEDIA ---]
    Discord: / discord
    Patreon: / gamemakerrob
    Itch: gamemaker-rob.itch.io/
    Twitter: / randomdude_sdu
    ======
    Credits
    ======
    Music by Avgvst.
    Licensed CC-BY
    Monster Sprite by David Gervais
    creativecommons.org/licenses/...

КОМЕНТАРІ • 175

  • @poldin_5396
    @poldin_5396 2 роки тому +52

    hello, i'm from Brazil and i'm writing this in the translator because i can't speak english, but i'd like to thank you for this code you made, saved mine and motivated me to continue programming :)

    • @GameMakerRob
      @GameMakerRob  2 роки тому +15

      That's great to hear man - keep it up!

    • @joao1857
      @joao1857 10 місяців тому +1

      Sou br tbm e estou iniciando na programação, tutorial mt show!!!

    • @Gatodeterno-bu6nb
      @Gatodeterno-bu6nb 3 дні тому

      tbm sou br e é muito bom o tutorial

  • @joytotheworld2048
    @joytotheworld2048 4 роки тому +24

    I think this is the best video on camera basics out there, thanks for keeping it simple.

  • @mothamaurot605
    @mothamaurot605 Рік тому +5

    Thank you so much for this video! I'm in a game development class and my teacher never taught us how to make the camera actually move with the player, so this saved my final project from looking really weird.

  • @bburpee
    @bburpee 2 роки тому +4

    Thank you! This is exactly what I needed to manipulate my cameras in cutscene sequences, based on an invisible object on the timeline (track panel). Great job.

  • @mailmallett
    @mailmallett 5 років тому +13

    I did not know you could have collapsible code. This video was worth it just for that. Ace.

  • @uhh-uhmm
    @uhh-uhmm 5 місяців тому +1

    YOU SOLVED 1 WEEK STRUGGLING WITH JITTERING WHEN FIXING DIAGONAL MOVE, TYSM

  • @Reqcore
    @Reqcore Рік тому +3

    Thank you so much for making this! I was going crazy trying to figure out how to fix the shaking from the viewports. Edit I had no idea it was the viewport, everything runs perfect now.

  • @love2o9
    @love2o9 Рік тому

    I've been trying to figure this out for literal hours, thank you

  • @szi8465
    @szi8465 5 місяців тому

    THANK YOU FINALLY A STRAIGHTFORWARD TUT

  • @Fragmentori
    @Fragmentori 4 роки тому +9

    THANK YOU SO MUCH BRO YOU SO HELPED ME FOR MY GAME

  • @lilred7679
    @lilred7679 Рік тому +2

    Great and simple code, keep up the good work!

  • @GameMakerRob
    @GameMakerRob  4 роки тому +3

    Want to clamp the camera to rooms of different sizes as well? (stop the camera going outside the boundaries of the room, regardless of room size) ua-cam.com/video/V8EQFq7GZgo/v-deo.html

  • @SampoZ
    @SampoZ 5 років тому +6

    ur intro is sick dude :d but btw great tutorial, i subbed!

  • @dman4435
    @dman4435 4 роки тому +4

    Had to dig this one out to do a little RPG math game for my boy today. So happy.

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      How old is he?

    • @dman4435
      @dman4435 4 роки тому +4

      @@GameMakerRob He is 9. I thought over the summer I would make a simple RPG. For practicing his multiplications he could go around looking for the correct answers shooting up stuff. The regular math games are not that exciting. Have to blow stuff and have some fun and learn too....haha.. thanks

  • @striaa_af
    @striaa_af 2 роки тому +2

    Easy to code and really working
    Love it!

  • @claytonscarmussin8945
    @claytonscarmussin8945 5 років тому +27

    Thank you so much dude, we brazilians have a expression for when someone really fucking help us a lot, is is "quebrou um galho e tanto"
    Really thanks bro
    Tou are amazing

    • @GameMakerRob
      @GameMakerRob  5 років тому +1

      Clayton Scarmussin you're welcome!

    • @vnts6082
      @vnts6082 5 років тому +2

      Hehehe um br por aqui ^^

    • @rafaeleuzebio3090
      @rafaeleuzebio3090 3 роки тому

      yaay, br's criando jogos ^-^

    • @ofaca1429
      @ofaca1429 3 роки тому

      Eu conheço essa expressão de algum lugar... seria você um brazilian?

    • @rafaeleuzebio3090
      @rafaeleuzebio3090 3 роки тому +1

      @@ofaca1429 are you brazillian mermão? Very loco ver brazillian in every place

  • @cerulean5881
    @cerulean5881 5 років тому +4

    thank you! worked perfectly!

  • @44kjules
    @44kjules Рік тому +2

    Bro i leanred so much!

  • @Fallout_yep_just_that_yea
    @Fallout_yep_just_that_yea 2 роки тому

    this guy deserves a like i tried many tutorials and it did not work but this is the only one that works

  • @kevinlong5104
    @kevinlong5104 3 роки тому +1

    thank you so much!! the clearest video about the camera I can find on youtube. Cheers mate!

    • @GameMakerRob
      @GameMakerRob  3 роки тому

      Kevin Long you're welcome! If you also want to know how to stop the camera moving outside the room there's a follow-up video in the description.

    • @kevinlong5104
      @kevinlong5104 3 роки тому

      @@GameMakerRob Sounds great! I'll be sure to check it out. Also I'm wondering do you happen to have a tutorial about how to animate the character in a 2D game like the one you show in the video? I'm trying to make an exactly same game. Thanks!

    • @GameMakerRob
      @GameMakerRob  3 роки тому

      Kevin Long lol well it just so happens I made a 25 episode series o how to make this kind of game and the video on how to make the characters change sprites is pretty early on. Check out the "Player Movement" video in the RPG starter kit series

    • @kevinlong5104
      @kevinlong5104 3 роки тому

      @@GameMakerRob That's brilliant! I'll go check them out. Appreciate it!

  • @VAMPIREBoyTHEBloodyMinecraft
    @VAMPIREBoyTHEBloodyMinecraft 3 роки тому

    YOU ARE A LEGEND. I swear this video will help anyone despite when they watch it.

  • @rickmiller9864
    @rickmiller9864 Рік тому

    Worked great! Thanks!

  • @theboredbraxton6900
    @theboredbraxton6900 Рік тому +1

    Thank you so much, this was very helpful as I'm making my first game!

  • @dman4435
    @dman4435 5 років тому

    Great video. Make it look easy. Thanks

  • @CaptainKuime
    @CaptainKuime 5 років тому +2

    Thanks for the tutorial

  • @cagatay7581
    @cagatay7581 3 роки тому

    You saved my project

  • @rajatnishad2119
    @rajatnishad2119 Рік тому

    Understandable. Have a nice day

  • @acrobatepee4894
    @acrobatepee4894 5 років тому +1

    Nice video it helped me a lot

    • @GameMakerRob
      @GameMakerRob  5 років тому

      I'm glad it helped and thanks for watching :)

  • @Grizz-909
    @Grizz-909 9 місяців тому

    you are an amazing human being

  • @Not_nistrepan
    @Not_nistrepan 2 місяці тому

    THANK YOU SOOO MUCH MAN IT WORKS PERFECTLY!!!!!!!!!!!!!!!GOD BLESS YOU

    • @Flame139
      @Flame139 2 місяці тому +1

      i'm thinking the same thing. its cool that this comment section is still alive after so many years of the video being up

  • @NightEdog21
    @NightEdog21 2 роки тому +2

    thank you this really helped!

  • @TVCrispClips
    @TVCrispClips Рік тому +2

    demon time

    • @44kjules
      @44kjules Рік тому +1

      Know i got that HONONOYNYOYRYRYRYEJTBAHSBFDSBFBDSHFBDF

  • @Underrated_Games
    @Underrated_Games Рік тому +1

    Thanks man I was having some trouble with my tank racing games with that

  • @eternalwarfare514
    @eternalwarfare514 4 роки тому +4

    At last, a simple code. Thanks bruv, you're a diamond.
    By the way, how would you stop the camera from moving beyond the border when the border of the room has been reached?

    • @GameMakerRob
      @GameMakerRob  4 роки тому +3

      I literally coded that for a tutorial video a few days ago, if you can wait a few days.
      If you want to try yourself, I just use 2 variables for where I want the camera to be, and then use the "clamp" function to make sure those 2 variables dont go below or above the values I want eg 0 for minimum and room-width - view_width as maximum for the x coordinate

    • @eternalwarfare514
      @eternalwarfare514 4 роки тому

      @@GameMakerRob Thanks bro, I'll try this first, and if my single brain cell can't make it work, then I'll wait for that video.

  • @ratronald
    @ratronald 2 роки тому +1

    i am a priest. i give blessing to you.

  • @BRYAN-vc2sh
    @BRYAN-vc2sh 3 роки тому +1

    Hi, I speak Spanish and I don't understand any English, but thanks to you I was able to make my view

    • @GameMakerRob
      @GameMakerRob  3 роки тому

      You're welcome man!

    • @BRYAN-vc2sh
      @BRYAN-vc2sh 3 роки тому

      @@GameMakerRob Thank you, I don't know English

  • @kingkirb2218
    @kingkirb2218 5 років тому +1

    Thank you so much man

  • @nutellie_was_here
    @nutellie_was_here 9 місяців тому

    when i load the game, the camera moves, except you cant see the player. the camera is also pretty small. Hlw would you go about fixing this?
    Edit: it seemed to have fixed itslef when i made the object smaller. But if there anyway to keep the sprite somewhat larger and still have the camera work, please let me know :)

    • @GameMakerRob
      @GameMakerRob  9 місяців тому

      How big is the sprite vs how big is the camera view (in pixels)

  • @SkeletonBro
    @SkeletonBro 3 роки тому

    Would I be able to make it so there are borders? (like how the default cam has horizontal and vertical borders) if so . . . how?

    • @GameMakerRob
      @GameMakerRob  3 роки тому +1

      Skeleton Bro I think the video link in the description is what you're looking for - it makes the camera stop at the rooms borders so that the camera isn't always centred on the player but te player is always in view.
      The borders don't have to be based on the room either, you can set them to whatever you like

  • @lisap4798
    @lisap4798 Рік тому +1

    thanks it worked :D

  • @matthewpittman5390
    @matthewpittman5390 3 роки тому

    Hey do you possibly know how to have the camera follow your player if you're at a certain part of the view? Similar style to Super Mario World on snes.

    • @GameMakerRob
      @GameMakerRob  3 роки тому +1

      I think this video will be more relevant for you - ua-cam.com/video/9fI91zL_P80/v-deo.html
      Instead of using the mouse cursor coordinates, use the player's x and y, and increase the size of the borders so that the player doesn't have to get to the edge before it scrolls

  • @tdmxross
    @tdmxross 2 роки тому +1

    thank you man :D

  • @Circuit_of_Nightshipping
    @Circuit_of_Nightshipping 4 роки тому +1

    So, I have a question... I wanted to make a game where the player has two different objects and has different abilities based on the object. I only have two objects for the player, but I cant seem to figure out a way to make the camera follow but one of them. When the player switches, it destroys the other object and creates the new one, but I cant get the camera to follow the new one... I tried making a second view (definitely not the right answer) and haven't found a way to make the object continue to be followed...

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      Whatever object this code is inside will make the camera follow it, so if you have the code in both objects (but only have 1 of them in the game at the same time) then it should work for both objects.
      You could make a camera object that has a target to follow instead, and then change the target that it's following (via a global variable being changed, for example) or you could just have 1 object for both things, with 2 states that you switch between to get the different effects/whatever

    • @Circuit_of_Nightshipping
      @Circuit_of_Nightshipping 4 роки тому +1

      @@GameMakerRob Thanks, I got it now though ^^' I made an "object_camera" and made it into a parent for both of my characters, and then set the game camera to follow the "object_camera" which ended with both characters being followed since they adopted the code; thank you for your time though, i was super confused at first and it makes me feel a little better to know that i could get help if I still needed it, thank you for your time! ^^

    • @GameMakerRob
      @GameMakerRob  4 роки тому

      Circuit of Nightshipping good stuff!

  • @leokokkonen3787
    @leokokkonen3787 3 роки тому +2

    thanks

  • @Happy-mz3sc
    @Happy-mz3sc 5 місяців тому

    hi, if you have a problem like me, just move the first two lines of code in the create event.

  • @DeathDome_
    @DeathDome_ Місяць тому

    is there a way to do this with drag and drop?

  • @el_quasar695
    @el_quasar695 2 роки тому

    Thank you !

  • @thecatacombhimself
    @thecatacombhimself Рік тому

    it just doesn't move with the player at all, dont know what i did wrong

  • @SM-xow123
    @SM-xow123 3 роки тому +1

    THNX !

  • @cosmowo
    @cosmowo 5 років тому +1

    Thanks but it's important to note that unless you plan on changing the size of the camera's view during playtime, you shouldn't calculate half of the view every end step but rather at the initialization or creation event of the player which could help with efficiency. :)

    • @GameMakerRob
      @GameMakerRob  5 років тому

      That's very true - it's unnecessary to calculate the size of the view every step. I think it's because I took my code from a zoom object I was using.

    • @GreetingsField
      @GreetingsField 5 років тому +1

      @@GameMakerRob When I tried to put it in the creation event, it didn't seem to work but it looks like it runs flawlessly in the End Step at least.

    • @GameMakerRob
      @GameMakerRob  5 років тому

      GreetingsField the calculation to determine half the view size? I guess it can depend on what you have going on in your game.
      Having the code in the end step is perfectly fine IMO

    • @GreetingsField
      @GreetingsField 5 років тому +1

      @@GameMakerRob Oh, right, haha, I assumed the camera position was going to be set there in the same place, haha, no wonder it didn't work. Moving the basic calculation over works fine!

  • @supermario1352
    @supermario1352 4 роки тому

    Hi!Thanks bro!I realy appreciate your video but I have one problem...When I go to the world s edge the game glitches.Can u help me?
    Edit:I resorved it.I had to make the camera follow the player and to change the horizontal border and the vertical border to 32.Thanks again!

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      You have to use the relevant gamemaker 1.4 functions like view_xview docs.yoyogames.com/source/dadiospice/002_reference/windows%20and%20views/views/index.html
      The camera functions changed with 2.0

  • @echoloyalty995
    @echoloyalty995 Рік тому

    not sure if anyone can help me on this.
    i used both the movement and the camera follow vids. they work, how ever the player is always off center.

    • @GameMakerRob
      @GameMakerRob  Рік тому

      the x/y of the camera is at the top left of the screen, and calculating the camera coordinates should also take into account the sprite_xoffset and sprite_yoffset of the player sprite.
      Eg if the player sprite origin is different compared to the one in the video, you'll probably see an off-centre player

  • @redoned.8446
    @redoned.8446 4 роки тому

    Sorry I’m late, but can you answer my question? Are you able to make the camera follow you but when it hits an edge of the room size the camera stops moving but the player is still able to move. I tried the ‘clamp’ but it stopped the camera and the player as well when the camera hit the edge of the level. Please help and thank you.

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      Hey man, clamp will work, you just need to set it to:
      cx = clamp(cx, 0, room_width - camera_get_view_width(view_camera[0]) );
      and cy = clamp (cy, 0, room_height - camera_get_view_height(view_camera[0]) );
      If you copy/paste this code, check I have enough parantheses etc, its easy to make mistakes typing it in a comment.
      I have wondered a couple of times whether I should do a follow up video to show how to clamp the camera like this. The code I gave here will work as long as your "levels / dungeons etc" are confined to the width/height of the room

    • @redoned.8446
      @redoned.8446 4 роки тому +1

      Hey thanks pal. I didn’t think you would help, especially this quick, to my comment since this video came out two years ago. I really appreciate the help.

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      @@redoned.8446 NP man, I always try to reply if I can. After I finish the Isometric Tactics Tutorial series I'm doing the extra camera stuff will probably be the first thing I do

    • @redoned.8446
      @redoned.8446 4 роки тому

      Sorry to ask, but what is ‘cx’ and ‘cy’? Were these used in another video? I’m just a little confused.

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      REDONED. ? Yes, actually. cx = x - halfViewWidth;
      cy = y - halfViewHeight;
      //now put the clamp code
      //now set the camera to cx/cy
      Basically we're getting the coordinates to center the camera on the player, then clamping those coordinates to make the view stay inside the room, then setting the view to those coordinates

  • @raynature5901
    @raynature5901 5 років тому +1

    Tysm

  • @AlienAnthony
    @AlienAnthony 4 роки тому

    Great stuff. but can I just ask. why only play the music in the left ear?

    • @GameMakerRob
      @GameMakerRob  4 роки тому

      Alien Anthony I had no idea that was even happening lol...

  • @kingkirb2218
    @kingkirb2218 5 років тому +1

    Sorry for all the requests, but I was wondering if you were going to my a dialogue system tutorial

    • @GameMakerRob
      @GameMakerRob  5 років тому

      King Kirb dialogue like in the MyRPG video?

    • @kingkirb2218
      @kingkirb2218 5 років тому

      GameMaker Rob Yeah

    • @GameMakerRob
      @GameMakerRob  5 років тому

      King Kirb maybe next week I have to finish another video first ;)

  • @CuminDragon
    @CuminDragon 4 роки тому +2

    First camera I set up was based on a super complicated 3d one.
    Wtf young me why didnt I find this.

    • @GameMakerRob
      @GameMakerRob  4 роки тому +1

      LuckyOwl lol if you wanna teach me about a 3D camera that's something I haven't mastered yet

    • @CuminDragon
      @CuminDragon 4 роки тому

      GameMaker Rob dont remember it, I left gamemaker for school for a while, I think there are tutorials on it somewhere though

  • @ATLASSCP420GTFORN
    @ATLASSCP420GTFORN Рік тому

    Nice

  • @vrtexxradiation
    @vrtexxradiation 8 місяців тому

    thank you :)

  • @skillfenix1570
    @skillfenix1570 2 роки тому

    hello, i followed your tutorial but my character's sprite gets a little distorted. do you know how to solve?

    • @GameMakerRob
      @GameMakerRob  2 роки тому

      it's a bit too vague to know the cause of your problem. Maybe it's an aspect ratio problem? This tutorial is just a camera tutorial though, and doesn't touch this.
      Are you running the game in full screen? If so, does the problem still happen in windowed mode?

    • @skillfenix1570
      @skillfenix1570 2 роки тому

      @@GameMakerRob no, my game is not in full screen. if this is a ratio problem, do you have any idea how I can solve it? (I know the tutorial isn't about that, sorry. The camera works very well ​by the way.)

    • @GameMakerRob
      @GameMakerRob  2 роки тому

      @@skillfenix1570 when you set your camera view, the "ratio" between the view and the port need to match. Eg if your view of the room is 200x400 and then your game screen is 300x600, you will see some weird sprites

  • @stef3162
    @stef3162 3 роки тому

    hello, i am making an platformer and only want the camera to move on the x-axis is this possible with your code

    • @GameMakerRob
      @GameMakerRob  3 роки тому

      Try using it without adjusting the y of the camera (although you'll want to set things up so the player starts within the view).
      You might also still want the y to change but only when the player gets within a certain distance of the top/bottom of the view.

    • @stef3162
      @stef3162 3 роки тому +1

      @@GameMakerRob i just changed this: camera_set_view_pos(view_camera[0], x - halfviewwith , 237);

  • @kboltiz
    @kboltiz 4 роки тому +1

    Bruh do I have to do something special to make the camera functions in GMS1? Cuz for me it's just grey text.

    • @GameMakerRob
      @GameMakerRob  4 роки тому

      You have to use the gamemaker 1.4 functions like view_xview - docs.yoyogames.com/source/dadiospice/002_reference/windows%20and%20views/views/index.html

  • @gardud7
    @gardud7 Рік тому

    in my game i have a moth that follows my mouse cursor when i click the right button. i used this code and it works but i notice that when my moth gets to the edge of the room a duplicating clipping thing happens on the outside border of the room. like the background trys to do that mouse trail thing like on old windows xp computers. any way i can fix this?

    • @GameMakerRob
      @GameMakerRob  Рік тому

      Sounds like there's no background. Check the settings in your room.

    • @gardud7
      @gardud7 Рік тому

      @@GameMakerRob I have a background of a brick wall. It's in the background tab

    • @GameMakerRob
      @GameMakerRob  Рік тому

      @@gardud7 is the size of the view greater than the size of the room?

    • @gardud7
      @gardud7 Рік тому

      @@GameMakerRob the size of the view is smaller but it seems that since the camera is keeping the character in the center the player is allowed to go to the very edge of the screen so the camera view goes past the background image. The size is the same as your video. I would need to have it set up in a way that allowed the camera edge to stop at the edge of the room and allow the player to move away from the center of the camera.

    • @GameMakerRob
      @GameMakerRob  Рік тому

      @@gardud7 is the camera clamped to the width/height of the room?

  • @n3l20
    @n3l20 7 місяців тому +1

    Can you tell me why my room is now infinite?

    • @GameMakerRob
      @GameMakerRob  7 місяців тому

      Rooms are always infinite, even if you make it a 1x1 pixel size. Where you allow the camera to move/ camera size is what limits what you see in-game.

  • @xx_yourmomplayz69xd_xx61
    @xx_yourmomplayz69xd_xx61 Рік тому

    Mine is still jittery... How do you fix this?
    Also, thank you so much for the tutorial!

    • @GameMakerRob
      @GameMakerRob  Рік тому

      You can just have the code in the player step. As long as the camera is being set after the players moves then you should escape the jitteriness

    • @xx_yourmomplayz69xd_xx61
      @xx_yourmomplayz69xd_xx61 Рік тому

      @@GameMakerRob I tried making it before and after, and in the player step, before and after. none of them worked :(

    • @GameMakerRob
      @GameMakerRob  Рік тому

      @@xx_yourmomplayz69xd_xx61 you can just put the code in the player object, after it moves

  • @Weirdosocool
    @Weirdosocool 3 роки тому

    thanks alot

  • @draiic
    @draiic 2 роки тому

    Chungus cursor. Great tutorial but why on End Step? :]

    • @GameMakerRob
      @GameMakerRob  2 роки тому

      so that the player has already moved before the camera is updated. As long as the code runs after the player movement (eg on the lines below it in the same event) it's all good

  • @RobertChambers1522
    @RobertChambers1522 5 років тому

    I did everything you just did and the game crashed on startup
    FATAL ERROR in
    action number 1
    of Step Event2
    for object obj_player:
    Variable obj_player.halfviewheight(100004, -2147483648) not set before reading it.
    at gml_Object_obj_player_Step_2 (line 10) - camera_set_view_pos(view_camera[0], x - halfviewwidth, y - halfviewheight);

    • @GameMakerRob
      @GameMakerRob  5 років тому

      Robert Chambers the message says that halfviewheight wasn't set before GM tried to read it.
      Check the spelling of the variables when you set them. If you did what I did exactly you shouldn't have any crashes (or else I would have had them too)

    • @RobertChambers1522
      @RobertChambers1522 5 років тому +1

      @@GameMakerRob ahh gotcha. Looks like I forgot to capitalize them.

    • @GameMakerRob
      @GameMakerRob  5 років тому

      Robert Chambers if you're using GM2 there's a yellow triangle with an exclamation mark if a variable is only used once. It's a good way to tell if you've made a typing mistake or not.

  • @ImFrAlex
    @ImFrAlex 2 роки тому

    how would I make it follow the mouse?

    • @GameMakerRob
      @GameMakerRob  2 роки тому

      Instead of using the player coordinates, use mouse_x and mouse_y

    • @ImFrAlex
      @ImFrAlex 2 роки тому

      @@GameMakerRob I use the create event right?

    • @GameMakerRob
      @GameMakerRob  2 роки тому

      @@ImFrAlex No, the create event only runs once - when an instance is first created. To make things happen all the time, the step event is usually the best place to do it.
      There are usually 60 steps in a second in gamemaker rooms, and that's where you want to be checking the mouse coordinates and moving the camera accordingly

  • @Parzival6969_
    @Parzival6969_ 5 років тому

    i get an error about the line "#region" anyone knows why?

    • @GameMakerRob
      @GameMakerRob  5 років тому

      What does the error say? If it's a red mark on the same line it might mean you're missing an #endregion to close it off

    • @ian-qo8fq
      @ian-qo8fq 4 роки тому

      it might be because you're using an older version of game maker Like: game maker studio 1 Or game maker 8

  • @prpr2301
    @prpr2301 Рік тому

    i'm sorry, i'm new to this and need help. At 3:10 there's a square that appears to the left of #region with lines going up and down. It didn't appear for me when i wrote this code. Am I supposed to do something to make it appear?

  • @nekorno6657
    @nekorno6657 4 роки тому

    i love you

  • @carsonskjerdal473
    @carsonskjerdal473 3 роки тому

    Yeah Object following just did not work for me, this is a great solution

  • @rlfraguas8541
    @rlfraguas8541 4 роки тому

    mine just worked like this:
    #region MOVE THE VIEW
    halfviewWidth = camera_get_view_width(view_camera[0]) / 2.5;
    halfviewHeight = camera_get_view_height(view_camera[0]) / 1.5;
    camera_set_view_pos(view_camera[0], x - halfviewHeight, y - halfviewWidth);
    #endregion

  • @Sparkie_106
    @Sparkie_106 4 місяці тому +1

    didnt work.

  • @user-mw9dy5ok5u
    @user-mw9dy5ok5u 8 місяців тому

    fala de cuo i ne cuo

  • @nemesis666first
    @nemesis666first 2 роки тому

    The intro is fucked up : the sound is only in the left ear...

  • @YellowFlagMaxim11Y
    @YellowFlagMaxim11Y 2 роки тому

    don't work

    • @GameMakerRob
      @GameMakerRob  2 роки тому +1

      It's more likely that you implemented it incorrectly

  • @Beetroo3
    @Beetroo3 28 днів тому

    I'm having trouble because of
    ERROR in
    action number 1
    of Step Event2
    for object Obj_Player:
    Variable .halfViewHeigh(100012, -2147483648) not set before reading it.
    at gml_Object_Obj_Player_Step_2 (line 6) - camera_set_view_pos(view_camera[0], x - halfViewWidth, y- halfViewHeigh);
    ############################################################################################
    gml_Object_Obj_Player_Step_2 (line 6) does anybody have tips

    • @GameMakerRob
      @GameMakerRob  27 днів тому

      @@Beetroo3 you're missing a "t" on the end of halfViewHeigh

    • @Beetroo3
      @Beetroo3 27 днів тому +1

      @@GameMakerRob Thank you the camera works exactly how I wanted it to.
      I am thankful you respond to comment on 5 year old videos, ill have to check the other camera videos

    • @GameMakerRob
      @GameMakerRob  27 днів тому

      @@Beetroo3 lol np