#Trying to make a custom room transition need help

194 messages · Page 1 of 1 (latest)

raw notch
#

continuing to use the Undertale TML engine and so far its been fun however how they do room transitions is not to my liking + is a little jank with a custom camera (Thank you for helping me with that Zetsu!).

#

The code for each thing within the warp trigger

#

Create and step code for the parent trigger

#

And I was originally using this video for guidance but it didn't work due to what the engine already has in it
https://youtu.be/xlqFO_fuCEo?si=_wak-AMK06o-n9JJ

#

How I wanted it be was
Player walks into door way, transition starts, they cant move, as transition is reversing (to end) player still cant move till its done, its so they dont see the flicker of the camera zooming to that room while transitioning

#

but they used 2 different systems so Im having trouble with it-

pine wasp
#

Using camera_set_view_position

raw notch
dark hound
#

where'd you get 0,0 from

raw notch
#

oh wait would I just leave it as x, y,

dark hound
#

who's x,y

raw notch
dark hound
#

yes, but who's x,y

#

those x,y are just arguments to the function

#

also

#

show code on how you're making your camera follow the player

raw notch
#
event_user(0);

_camera=camera_create_view(x,y,width/scale_x,height/scale_y,angle,target,-1,-1,width/scale_x/2,height/scale_y/2);```
dark hound
raw notch
#
if(shake_x>0){
    if(_shake_time_x>0){
        _shake_time_x-=1;
    }else{
        if(!shake_random_x){
            if(_shake_positive_x){
                _shake_pos_x=shake_x;
            }else{
                shake_x-=shake_decrease_x;
                _shake_pos_x=-shake_x;
            }
            _shake_positive_x=!_shake_positive_x;
        }else{
            _shake_pos_x=random_range(-shake_x,shake_x);
            shake_x-=shake_decrease_x;
        }
        _shake_time_x=shake_speed_x;
    }
}else{
    shake_speed_x=0;
    shake_decrease_x=1;
    shake_random_x=false;
    _shake_time_x=0;
    _shake_pos_x=0;
    _shake_positive_x=true;
}
if(shake_y>0){
    if(_shake_time_y>0){
        _shake_time_y-=1;
    }else{
        if(!shake_random_y){
            if(_shake_positive_y){
                _shake_pos_y=shake_y;
            }else{
                shake_y-=shake_decrease_y;
                _shake_pos_y=-shake_y;
            }
            _shake_positive_y=!_shake_positive_y;
        }else{
            _shake_pos_y=random_range(-shake_y,shake_y);
            shake_y-=shake_decrease_y;
        }
        _shake_time_y=shake_speed_y;
    }
}else{
    shake_speed_y=0;
    shake_decrease_y=1;
    shake_random_y=false;
    _shake_time_y=0;
    _shake_pos_y=0;
    _shake_positive_y=true;
}


if(!instance_exists(target)){
    camera_set_view_target(_camera,noone);
    camera_set_view_pos(_camera,x+_shake_pos_x,y+_shake_pos_y);
}else{
    var spd = 0.20 //or however fast
    x = lerp(x, target.x - width/scale_x/2, spd )
    y = lerp(y, target.y - height/scale_y/2, spd )
    camera_set_view_pos(_camera, x,y)
}
camera_set_view_size(_camera,width/scale_x,height/scale_y);
camera_set_view_angle(_camera,angle);```
dark hound
#

ok

#

you're using x,y

#

cool

room start event

if instance_exists(target){
  x = target.x
  y = target.y
}
#

that's it

raw notch
#

the camera still does that even with that in the room start event

dark hound
#
camera_set_view_pos(_camera, x,y)

pop this in too then

#

ah wait

#
if instance_exists(target){
    x = target.x - width/scale_x/2
    y = target.y - height/scale_y/2
    camera_set_view_pos(_camera, x,y)
}
#

that's what needs to go

#

edited

raw notch
dark hound
#

you...didn't edit

#

do you see it says edited?

#

also your order is wrong

raw notch
#

Its working now, is there anyway I can still stop the camera from coming to an abrupt start without that spd variable and keep the solid room transition though

dark hound
#

what?

raw notch
#

#1251990048375705751 message

how zetsu described it, the camera comes to an abrubt stop making it look like the sprite shifts to the left or right when it doesn't while the walking animation plays

dark hound
#

is there anyway I can still stop the camera from coming to an abrupt start without that spd variable
no
and keep the solid room transition though
what's the room transition got to do with spd

raw notch
#

Look im not the best at explaining, what I meant was that spd variable is what caused the camera to do that when switching rooms and by "solid room transition" I just meant when the camera stays completely still when switching rooms

dark hound
#

so you want it to stop moving when the transition is happening

#

instead of still moving a little bit

raw notch
#

Basically I wanted to keep that smooth camera from before + Just make the camera move while its fading rooms instead of after

dark hound
#

you're making less sense

#

wdym by make the camera move while it's fading room

#

move where

dark hound
#

so that the catching up doesn't need to happen

dark hound
#

so idk what you're talking about

maybe a video would help your explanation?

raw notch
#

I can do a video yeah, that would probably help better...

#

give me maybe 10ish minutes if thats fine

dark hound
#

no guarantee i'll be around. just post it and if someone can they'll help

raw notch
#

Alright

dark hound
# dark hound ```gml if instance_exists(target){ x = target.x - width/scale_x/2 y = ta...

so...

this didn't work? what event did you put it in what object

the solution doesn't remove the speed variable. the speed variable is still there in the step event. the step event stays unchanged

the code i posted goes in room start

the whole idea is that you're teleporting the camera to where it needs to be immediately at room start, so that it's not needing to do the catch up. then when you move around in your game, it starts having to catch up again and that's your smooth camera

raw notch
#

I did put it in room start.
You told me to edit this

    var spd = 0.20 //or however fast
    x = target.x - width/scale_x/2
    y = target.y - height/scale_y/2
    camera_set_view_pos(_camera, x,y)
}

to

if instance_exists(target){
    x = target.x - width/scale_x/2
    y = target.y - height/scale_y/2
    camera_set_view_pos(_camera, x,y)
}```
#

which removes that var spd variable.

dark hound
#

in the room start event, yes?
of the camera object?

#

spd/lerp in step
no spd in room start

raw notch
#

yes-
I was in the middle of typing about it before you said something
and if it helps I can show what was in room start prior

dark hound
#

🤔 so it wasn't working...hmm

raw notch
#

I was gonna paste what I was typing (it did work but I got some general opinions from friends) about whether I should have the camera be the changed or the smooth with the catchup.
Personally for now I'm going to use this edited one you helped me with because its what I wanted initially

What I was typing prior:
They prefer the smooth one but said both works However I have a fairly good use case for this edited one just in case I go back to the smooth one so it doesn't do the whole catchup with specific scenarios (I will not elaborate), and I'm going to retry that tutorial from that video that adds custom transitions (that aren't a generic fade) which will make the camera catchup less obvious hopefully (which was the other half of this question initially...)

Thanks for helping though (sorry that I made things a complicated on accident), I tried my best to explain it in the videos... Also I didn't say it didn't work it was just a hard choice with the camera since I couldn't have one or the other, smooth camera or no catch up .

dark hound
#

when you say catch up
you're referring to the catch up in the room transition, right?

raw notch
#

yeah...

dark hound
#

that's...what i was tryna fix

#

there are other reasons why the code i gave wouldn't work

#

you can have smooth camera and have it not do the weird teleporty thing at the start

#

would you...like to fix it?

raw notch
#

yeah I would also
Can I show something in video format rq (gotta make the video) just a side by side of it before and after the change (like how both end up looking (idk it might help)

dark hound
#

sure

raw notch
#

ok

dark hound
#

while you're at it, answer me this:

#

is your player persistent and gets teleported to where it needs to be when you go to a new room

raw notch
#

how the engine works it requires the player object in each room (it breaks if its persistent) I can show the player stuff too if you want.

dark hound
#

so it's not persistent

#

well that ruins that theory

#

hmm

#

if the player isn't persistent then the issue isn't what i think it is

#

show me all your camera's code again

raw notch
#

one video coming up (I'll need a few minutes)

dark hound
#

show camera code in screenshots please i don't wanna pause videos for code

raw notch
#

ok mb

dark hound
#

makes it really hard to refer back and forth

raw notch
#

fair enough

#

step may require 2/3 images in itself so I'll separate those 3 when sending

dark hound
#

sure

#

as long as line count is visible

raw notch
#

the three at the bottom of room start are default for said engine I probably put camera_set_view_pos(_camera, x,y) in the wrong order-
The user event is just a camera shake event I dont think I would affect this

Adding step now

dark hound
#

your room start code is wrong

#
event_user(0)

view_enabled = true
view_camera[0] = _camera
view_visible[0] = true

if instance_exists(target){
  x = target.x - width/scale_x/2
  y = target.y - height/scale_y/2
  camera_set_view_pos(_camera, x,y)
}
#

x = target.x
y = target.y

was old code, pre correction

raw notch
#

OOOOOO
omg-
im actually dumb
this whole time I didn't think you were telling me to put

  x = target.x - width/scale_x/2
  y = target.y - height/scale_y/2
  camera_set_view_pos(_camera, x,y)
}```
In room start too...
"was old code, pre correction" why am I not surprised that I managed to mess that up
#

ok well the camera still does the catch up even with that

dark hound
#

repost your step event again?

#

oh you never showed your step event

#

that code should basically match the step event

#

just without the spd and lerp part

raw notch
#

Unchanged step event

    if(_shake_time_x>0){
        _shake_time_x-=1;
    }else{
        if(!shake_random_x){
            if(_shake_positive_x){
                _shake_pos_x=shake_x;
            }else{
                shake_x-=shake_decrease_x;
                _shake_pos_x=-shake_x;
            }
            _shake_positive_x=!_shake_positive_x;
        }else{
            _shake_pos_x=random_range(-shake_x,shake_x);
            shake_x-=shake_decrease_x;
        }
        _shake_time_x=shake_speed_x;
    }
}else{
    shake_speed_x=0;
    shake_decrease_x=1;
    shake_random_x=false;
    _shake_time_x=0;
    _shake_pos_x=0;
    _shake_positive_x=true;
}
if(shake_y>0){
    if(_shake_time_y>0){
        _shake_time_y-=1;
    }else{
        if(!shake_random_y){
            if(_shake_positive_y){
                _shake_pos_y=shake_y;
            }else{
                shake_y-=shake_decrease_y;
                _shake_pos_y=-shake_y;
            }
            _shake_positive_y=!_shake_positive_y;
        }else{
            _shake_pos_y=random_range(-shake_y,shake_y);
            shake_y-=shake_decrease_y;
        }
        _shake_time_y=shake_speed_y;
    }
}else{
    shake_speed_y=0;
    shake_decrease_y=1;
    shake_random_y=false;
    _shake_time_y=0;
    _shake_pos_y=0;
    _shake_positive_y=true;
}


if(!instance_exists(target)){
    camera_set_view_target(_camera,noone);
    camera_set_view_pos(_camera,x+_shake_pos_x,y+_shake_pos_y);
}else{
    var spd = 0.20 //or however fast
    x = lerp(x, target.x - width/scale_x/2, spd )
    y = lerp(y, target.y - height/scale_y/2, spd )
    camera_set_view_pos(_camera, x,y)
}
camera_set_view_size(_camera,width/scale_x,height/scale_y);
camera_set_view_angle(_camera,angle);```
dark hound
#

where is target set?

#

to the player object

#

cuz i see it's getting set to noone in your user event 0

#

which means in room_start that code doesn't run, because instance_exists(noone) is false

#

but i don't see where you set target=obj_player

#

is that in another object?

raw notch
#

Im looking

dark hound
#

ctrl shift f, project wide search for target=

raw notch
#

this is in the player code

dark hound
#

there we go

#

what triggers alarm[0]?

#

create?

#

it's something like

alarm[0] = ???

raw notch
#

Nothing that I can find so no apparently

dark hound
#

what's in the player's create event

#

the answer can't be no

raw notch
#

char_id=0;

res_idle_sprite[DIR.UP]=spr_char_frisk_up;
res_idle_sprite[DIR.DOWN]=spr_char_frisk_down;
res_idle_sprite[DIR.LEFT]=spr_char_frisk_right;
res_idle_sprite[DIR.RIGHT]=spr_char_frisk_right;
res_move_sprite[DIR.UP]=spr_char_frisk_up;
res_move_sprite[DIR.DOWN]=spr_char_frisk_down;
res_move_sprite[DIR.LEFT]=spr_char_frisk_right;
res_move_sprite[DIR.RIGHT]=spr_char_frisk_right;

moveable=true;
_moveable_dialog=true;
_moveable_menu=true;
_moveable_save=true;
_moveable_warp=true;
_moveable_encounter=true;
_moveable_box=true;```
dark hound
#

because that code runs

#

ok

what's in event_inherited()

#

what's in the player's parent?

raw notch
#

char_id=-1;
dir=DIR.DOWN;
dir_locked=false;

talking=false;

move_speed[DIR.UP]=2;
move_speed[DIR.DOWN]=2;
move_speed[DIR.LEFT]=2;
move_speed[DIR.RIGHT]=2;
move[DIR.UP]=0;
move[DIR.DOWN]=0;
move[DIR.LEFT]=0;
move[DIR.RIGHT]=0;

collision=true;

_collision_list=ds_list_create();

var proc=0;
repeat(4){
    res_idle_sprite[proc]=(sprite_exists(sprite_index) ? sprite_index : spr_default);
    res_idle_image[proc]=0;
    res_idle_speed[proc]=0;
    res_idle_flip_x[proc]=(proc==DIR.LEFT ? true : false);
    
    res_move_sprite[proc]=(sprite_exists(sprite_index) ? sprite_index : spr_default);
    res_move_image[proc]=1;
    res_move_speed[proc]=1/3;
    res_move_flip_x[proc]=(proc==DIR.LEFT ? true : false);
    
    res_talk_sprite[proc]=(sprite_exists(sprite_index) ? sprite_index : spr_default);
    res_talk_image[proc]=1;
    res_talk_speed[proc]=1/2;
    res_talk_flip_x[proc]=(proc==DIR.LEFT ? true : false);
    proc+=90;
}

res_override=false;

_talking_previous=!talking;
_dir_previous=-1;
_move_previous=-1;```
dark hound
#

you can also do a project wide search for alarm[0]=

raw notch
#

all the results

dark hound
#

room start

#

ok

raw notch
#

ok well I overlooked that then

#

var warp_landmark=Flag_Get(FLAG_TYPE.TEMP,FLAG_TEMP.TRIGGER_WARP_LANDMARK);
var warp_dir=Flag_Get(FLAG_TYPE.TEMP,FLAG_TEMP.TRIGGER_WARP_DIR);

if(warp_landmark!=-1&&instance_exists(hint_landmark)){
    var lx=x;
    var ly=y;
    with(hint_landmark){
        if(landmark_id==warp_landmark){
            lx=x;
            ly=y;
        }
    }
    x=lx;
    y=ly;
}
if(warp_dir!=-1){
    dir=warp_dir;
}

Flag_Set(FLAG_TYPE.TEMP,FLAG_TEMP.TRIGGER_WARP_LANDMARK,-1);
Flag_Set(FLAG_TYPE.TEMP,FLAG_TEMP.TRIGGER_WARP_DIR,-1);```
#

room start for player

dark hound
#

we need to match that for the camera

#

to make sure our camera teleportation runs after the player sets itself to be the target

#
//Camera room start

event_user(0)

view_enabled = true
view_camera[0] = _camera
view_visible[0] = true

alarm[0] = 2

//Camera Alarm 0
if instance_exists(target){
  x = target.x - width/scale_x/2
  y = target.y - height/scale_y/2
  camera_set_view_pos(_camera, x,y)
}
#

frankly starting to not be a fan of this system, it wasn't originally built for this

raw notch
#

I added it, I'll test it

dark hound
#

wait

#

your camera doesn't already have an alarm 0 event right?

#

just to be sure

the camera system i usually use does

raw notch
#

Yeah no the camera code had no alarm in it

#

to begin with

dark hound
#

ok that's fine then

#

if it did we'd need to put it in alarm[1] so it doesn't overlap, that's all

raw notch
#

Honestly, this things code is so wack, Adding the alarm didn't work- Im losing mind over here

dark hound
#

show me what you did

#

room start and alarm events of the camera

raw notch
dark hound
#

nope

raw notch
#

all I did was add the alarm

dark hound
#

this code

#

in the alarm event

#

moved

#

delete it from room start

raw notch
#

that makes more sense...

dark hound
raw notch
#

its in alarm 0

#

now

dark hound
#

show me

#

room start and alarm

raw notch
#

the right one is room start

dark hound
#

too much in alarm 0

#

not in alarm 2

#

omg

#

your room start is also wrong

#

you're all sorts of confused

#

ok

#

clear your room start

#

clear your alarm

#
event_user(0)

view_enabled = true
view_camera[0] = _camera
view_visible[0] = true

alarm[0] = 2
#

room start

#

that's it

#

once you're done with that

#

Alarm 0

if instance_exists(target){
  x = target.x - width/scale_x/2
  y = target.y - height/scale_y/2
  camera_set_view_pos(_camera, x,y)
}
#

just that

#

once you're done

#

show me both events again

raw notch
#

ok
I was already on that

dark hound
#

perfect

#

try it

raw notch
#

Im praying this works rn ngl

dark hound
#

code working on first try is a miracle

raw notch
#

OMG
FINALLY

dark hound
#

especially working with someone else's code

raw notch
#

And yeah ik its never gonna work first try (I mean it might but rarely)

dark hound
#

aight

#

anything else?

raw notch
#

Tysm dude- holy-
Nope nope
all good

dark hound
#

cuz before you leave

i have one question for you

#

do you know what we did and why that fixed things

raw notch
#

I cant fully explain with typing it but I do have a good general understanding of what we did and how it fixed it, + I can come back here to refer back to it if needed
So thank you, I can tell ya this different from lua and honestly still understanding game maker but again I do understand how what changes were made helped

dark hound
#

alright
as long as you're somewhat following and not just blindly copying and pasting code

raw notch
#

no Im not I can assure you on that

#

the copying and pasting part

#

Im following along-

#

dw