D
Danimtz
Guest
So I posted this on reddit, but I might as well post it here to see if anybody can help. Basically I'm trying
I'm trying to make a small top down shooter game in which the camera follows the player and the mouse position similar to Enter the Gungeon(This is a unity game) or Nuclear throne in Gamemaker Studio 2.
My first attempt I tried to simply create a view that follows an object. Then in that object's step event having this code:
x=mean(mouse_x,obj_Player.x);
y=mean(mouse_y,obj_Player.y);
However when I move the mouse around the camera always moves at increments of 1 pixel. Here is an example of what I mean
I have done research on how other pixel games acomplish a smoother camera:
surface_resize(application_surface,480,270)
Then when drawing the surface scaling it by a factor of 4 to give a 1920x1080 resolution. Then I tried to set up a new surface on top of the application_surface at 1920x1080 and have the camera scroll smoothly there. My reasoning is that each pixel in the application_surface should equal into 4 smaller pixels in the new surface, and should be able to allow the camera to move 4 times per pixel instead of just 1 pixel at a time.
I am fairly new to gamemaker so I'm not sure I am doing this correctly. Any help on how to to get this working would be greatly appreciated.
I'm trying to make a small top down shooter game in which the camera follows the player and the mouse position similar to Enter the Gungeon(This is a unity game) or Nuclear throne in Gamemaker Studio 2.
My first attempt I tried to simply create a view that follows an object. Then in that object's step event having this code:
x=mean(mouse_x,obj_Player.x);
y=mean(mouse_y,obj_Player.y);
However when I move the mouse around the camera always moves at increments of 1 pixel. Here is an example of what I mean
I have done research on how other pixel games acomplish a smoother camera:
- Steam post by the developer of Enter the Gungeon explaining how the camera works in their game(I know this game is made in Unity, however the concept is the same).
- This article from Gamasutra about scrolling in 2D games gives some ideas on how to do it. At one point in the article it mentions how Hyper Light Drifter achieves this smooth camera by rendering the game at 480x270 resolution but then having the camera scroll at full resolution.
surface_resize(application_surface,480,270)
Then when drawing the surface scaling it by a factor of 4 to give a 1920x1080 resolution. Then I tried to set up a new surface on top of the application_surface at 1920x1080 and have the camera scroll smoothly there. My reasoning is that each pixel in the application_surface should equal into 4 smaller pixels in the new surface, and should be able to allow the camera to move 4 times per pixel instead of just 1 pixel at a time.
I am fairly new to gamemaker so I'm not sure I am doing this correctly. Any help on how to to get this working would be greatly appreciated.