u/This_Wasabi_3038

Making Cam Room Adjust transition linear [HELP]

So i want to recreate the Zelda room transition where you would go to the edge of the screen and it would move your camera to the next room in a linear movement.

But my problem is that the transition is way too smooth and would like to fix that issue

here's my step camera code:

var _xOffset = 0
var _xMin = halfH
var _xMax = room_width - halfH
var _yOffset = 0
var _yMin = halfW
var _yMax = room_height - halfW
var _ca = global.curAdjust
if _ca != noone
{
`_xOffset = _ca.x_offset`



`_yOffset = _ca.y_offset`



`if _ca.left_clamp`

`{`

`_xMin = _ca.x + halfW`

`}`



`if _ca.right_clamp`

`{`

`_xMax = _ca.x + _ca.sprite_width - halfW`

`}`



`if _ca.up_clamp`

`{`

`_yMin = _ca.y + halfH`

`}`



`if _ca.down_clamp`

`{`

`_yMax = _ca.y + _ca.sprite_height - halfH`

`}`
}
`//cutscene mode`
if global.CamLock = true
{
`x += (follow.x - x) / panSpd`

`y += (follow.y - x) / panSpd`
}
transition_frame_count += 1
xx = oPlayer.x + _xOffset
yy = oPlayer.y + _yOffset
xx = clamp(xx, _xMin, _xMax)
yy = clamp(yy, _yMin, _yMax)
var _dx = (xx - x)
var _dy = (yy - y)
//cutscene mode OFF
if global.CamLock = false
{
`x += _dx`

`y += _dy`
}
x = clamp(x, 0 + halfW, room_width - halfW)
y = clamp(y, 0 + halfH, room_height - halfH)
camera_set_view_pos(cam, x - halfW, y - halfH)

note: _ca / global.curAdjustvariable is just checks if you are in a object's area where It would lock the camera to the "room"

reddit.com
u/This_Wasabi_3038 — 1 day ago